﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - ClientUI - UXDesktop - How to generate different window types based on the bound Item?</title><link>http://www.intersoftsolutions.com/Community/ClientUI/UXDesktop---How-to-generate-different-window-types-based-on-the-bound-Item/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>UXDesktop - How to generate different window types based on the bound Item?</title><link>http://www.intersoftsolutions.com/Community/ClientUI/UXDesktop---How-to-generate-different-window-types-based-on-the-bound-Item/</link><pubDate>Thu, 17 Feb 2011 10:04:26 GMT</pubDate><dc:creator>chrisaswain</dc:creator><category>UXDesktop</category><description>&lt;p&gt;I'm actually already using both an ItemContainerStyleSelector and an ItemContainerTemplateSelector so I can have different styles and datatemplates for UXWindows, UXNavigationWindows and UXChrome windows.  Everything seems to be working fine now.  Thanks for confirming that I found the right solution.  &lt;/p&gt;</description></item><item><title>UXDesktop - How to generate different window types based on the bound Item?</title><link>http://www.intersoftsolutions.com/Community/ClientUI/UXDesktop---How-to-generate-different-window-types-based-on-the-bound-Item/</link><pubDate>Wed, 16 Feb 2011 23:55:39 GMT</pubDate><dc:creator>jimmyps</dc:creator><category>UXDesktop</category><description>&lt;p&gt;Hi Chris,&lt;/p&gt;&lt;p&gt;You've got it right, thanks for sharing your solution. That is the technique to create custom item type in an items control.&lt;/p&gt;
&lt;p&gt;In another common scenario related to style customization, you may want to use ItemContainerStyleSelector of the control when you need to customize the style of the same target item type based on specific conditions. This allows you to perform the style conditioning in a separate class without have to override the control's class. More information and example about ItemContainerStyleSelector can be found &lt;a target="_blank" href="http://www.intersoftpt.com/Support/ClientUI/Documentation/Databinding.html#url=Intersoft.Client.Framework%7EIntersoft.Client.Framework.ISItemsControl%7EItemContainerStyleSelector.html"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Hope this helps,&lt;br /&gt;Jimmy &lt;br /&gt;&lt;/p&gt;</description></item><item><title>UXDesktop - How to generate different window types based on the bound Item?</title><link>http://www.intersoftsolutions.com/Community/ClientUI/UXDesktop---How-to-generate-different-window-types-based-on-the-bound-Item/</link><pubDate>Tue, 15 Feb 2011 11:06:54 GMT</pubDate><dc:creator>chrisaswain</dc:creator><category>UXDesktop</category><description>&lt;p&gt;I've come up with a solution that works.  I noticed that the IsItemItsOwnContainerOverride(object item) method always gets called before GetContainerForItemOverride().  Since the first method takes the item the window is bound to as a parameter, I can use the bound item to determine how to set a local variable in my inherited desktop specifying the type of window to be created next.  Then I just check that variable to determine if I should generated a UXWindow or a UXNavigationWindow or a UXChromeWindow.  &lt;/p&gt;
&lt;p&gt;Here is a simplified psuedo code example:&lt;/p&gt;
&lt;p&gt;//This class is the item bound to the window from the ItemsSource&lt;br /&gt;public class WindowItem&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;bool IsNavigationWindow {get;set;}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;//This is the custom implementation of the UXDesktop&lt;br /&gt;public class MyCustomDesktop : UXDesktop&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;//This enumeration defines the types of windows supported&lt;br /&gt;public enum WindowType&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;Window,&lt;/p&gt;
&lt;p&gt;NavigationWindow,&lt;/p&gt;
&lt;p&gt;ChromeWindow&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;//This keeps track of the type of window to be generated next&lt;br /&gt;private WindowType NewWindowType = WindowType.Window;&lt;/p&gt;
&lt;p&gt;protected override bool IsItemItsOwnContainer(object item)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;if (item is WindowItem)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;if (((WindowItem)item).IsNavigationWindow)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;NewWindowType = WindowType.NavigationWindow;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;else&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;NewWindowType = WindowType.Window;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;return base.IsItemItsOwnContainerOverride(item);&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;protected override DependencyObject GetContainerForItmeOverride()&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;UXWindow newWindow = null;&lt;/p&gt;
&lt;p&gt;if (NewWindowType == WindowType.NavigationWindow)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;newWindow = new UXNavigationWindow();&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;else&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;newWindow = new UXWindow();&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;...&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;</description></item><item><title>UXDesktop - How to generate different window types based on the bound Item?</title><link>http://www.intersoftsolutions.com/Community/ClientUI/UXDesktop---How-to-generate-different-window-types-based-on-the-bound-Item/</link><pubDate>Mon, 14 Feb 2011 11:46:09 GMT</pubDate><dc:creator>chrisaswain</dc:creator><category>UXDesktop</category><description>&lt;p&gt;Thanks.  Let me know as soon as you have a solution as my project is in urgent need of this capability.  &lt;/p&gt;</description></item><item><title>UXDesktop - How to generate different window types based on the bound Item?</title><link>http://www.intersoftsolutions.com/Community/ClientUI/UXDesktop---How-to-generate-different-window-types-based-on-the-bound-Item/</link><pubDate>Fri, 11 Feb 2011 05:54:54 GMT</pubDate><dc:creator>handy@intersoftpt.com</dc:creator><category>UXDesktop</category><description>&lt;p&gt;Hello Chris,&lt;/p&gt;&lt;p&gt;Regarding this scenario, I would need a little more time to discuss with our developer teams. We would suggest what is the best approach for your scenario. I will be back asap.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Handy&lt;/p&gt;</description></item><item><title>UXDesktop - How to generate different window types based on the bound Item?</title><link>http://www.intersoftsolutions.com/Community/ClientUI/UXDesktop---How-to-generate-different-window-types-based-on-the-bound-Item/</link><pubDate>Thu, 10 Feb 2011 16:14:43 GMT</pubDate><dc:creator>chrisaswain</dc:creator><category>UXDesktop</category><description>&lt;p&gt;Any idea if this is possible?  Do I need to use a custom ItemsContainerGenerator or something?&lt;/p&gt;</description></item><item><title>UXDesktop - How to generate different window types based on the bound Item?</title><link>http://www.intersoftsolutions.com/Community/ClientUI/UXDesktop---How-to-generate-different-window-types-based-on-the-bound-Item/</link><pubDate>Wed, 09 Feb 2011 12:52:49 GMT</pubDate><dc:creator>chrisaswain</dc:creator><category>UXDesktop</category><description>&lt;p&gt;I have a custom implementation of the UXDesktop control that overrides the GetContainerForItemOverride() method.  In that method, I create new UXWindow objects and set some default properties and command bindings.  That has worked great up until now.  I have new requirements now to have the desktop generate UXWindows for some bound items in the ItemsSource, but also generate UXNavigationWindows for other items in the ItemsSource.  &lt;/p&gt;
&lt;p&gt;Ideally, I'd like to be able to check for a property on each item being bound before creating the new window object.  The item would have a property telling the desktop what type of window to generate.  &lt;/p&gt;
&lt;p&gt;What is the best way to accomplish this?&lt;/p&gt;</description></item></channel></rss>