iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
Is there an example of how to use the ItemsSource property of the UXDesktop control?
I tried using it in a similar way to how I'm using the ItemsSource property on the UXDesktopDock control, but it doesn't seem to work. An example would be great!
I've tried binding the ItemsSource property to the underlying collection in my ViewModel and setting the ItemContainerStyleTemplate to a template the does the PropertyBinding and sets the IsActive property to True. But still no windows show up.
Hello,
I have tried to create your scenario using ItemsSource in UXDesktop. Using a sample data created from Intersoft ClientUI Desktop application template, I have bound a ViewModel with Contacts collection and specified ItemContainerStyle for UXDesktop. Here is the code that I used:
<Intersoft:UXDesktop x:Name="uxMyDesktop" DataContext="{Binding Source={StaticResource ContactsViewModel}, Path=Contacts}" ItemContainerStyleSelector="{StaticResource ContactStackItemStyleSelector}" ItemsSource="{Binding}" DisplayMemberPath="Contact.Name" ImageMemberPath="Contact.Photo"> </Intersoft:UXDesktop>
When I run the project with these settings, the UXDesktop will bind the Contacts collection and create UXWindow objects automatically.
Will this code useful for your scenario?
Thank you.
Hello Chris,
You need to create a class which inherits UXDesktop, and then override GetContainerForItemOverride() method and return a new UXWindow instead of UXWindowChrome.
I create a class named GetUXWindow.cs and the code looks like following:
public class GetUXWindow : UXDesktop { protected override DependencyObject GetContainerForItemOverride() { UXWindow newWindow = new UXWindow(); newWindow.IsClientVisible = true; newWindow.CanMaximize = true; newWindow.CanMinimize = true; newWindow.CanMove = true; newWindow.CanResize = true; return newWindow; } }
Declare the new class like following:
<ViewModels:GetUXWindow x:Key="GetUXWindow"/>
Then, replace the UXDesktop control with the class you have created like following:
<ViewModels:GetUXWindow x:Name="uxMyDesktop" DataContext="{Binding Source={StaticResource ContactsViewModel}, Path=Contacts}" ItemContainerStyleSelector="{StaticResource ContactStackItemStyleSelector}" ItemsSource="{Binding}" DisplayMemberPath="Contact.Name" ImageMemberPath="Contact.Photo"> </ViewModels:GetUXWindow>
When you run the project, UXDesktop will create UXWindow objects with its behavior.
Hope this helps.
More info about what I'm doing...
I have a single ViewModel for both my desktop and taskbar. It has an ObservableCollection that keeps track of my app instances. An "Instance" being a window containing some functionality and a corresponding taskbar instance stack item.
I need to bind to this collection in both the desktop and the taskbar. Right now, I have the binding working great in the taskbar (UXDesktopDock). It is successfully creating application "group" buttons and application "instance" stack items when an app is opened (functionality like the Windows 7 taskbar).
I'd like to have my desktop bind to the same collection and add/remove windows as the collection changes.
I suppose I should ask if I should even be using the UXDesktop control since I'm not integrating with the UXDesktopDock in the traditional manner?
I could just create my own ItemsControl and ItemContainerGenerator that will wrap my items in UXWindow controls. Then I could handle the window arrangement myself.
Is there really any benefit in using the UXDesktop control for my scenario?
It depends on your scenario whether you need to use UXDesktop or not.
What is your difficulty to use ItemSource in UXDesktop? And, how do you want to apply them? I might need a more details scenario to have a better idea for this issue.
If your scenario works without UXDesktop, then it is not necessary to use/integrate with UXDesktop.
I have a ViewModel with an ObservableCollection property I want to bind to my UXDesktop.ItemsSource. I have an ItemContainerStyle specified for my UXDesktop where I define some properties.
I want the UXDesktop to bind to my ObservableCollection and create UXWindow objects. I was under the impression that the ItemsSource property on the UXDesktop was there so you could bind any collection to it and the desktop would generate window objects for you.
I managed to get it working thanks to your example source code. I was missing the DisplayMemberPath and the ImageMemberPath properties on my UXDesktop control. I was under the impression that these were not needed since I was customizing the binding in the ItemContainerStyle, but I guess I was wrong.
Another interesting question:
My datasource for my taskbar is hierarchical so it can show an application instance group button on the task bar and butttons for each instance as stack items. However, I'd like to bind the UXDesktop to just the instances on the same datasource so a window gets created and managed for each application instance stack item and not just a window for the group of instances. Any suggestions?
Example Datasource structure:
[AppInstanceGroups collection]
-<AppInstanceGroup>
-Name property
-Icon property
-[AppInstances collection]
-<AppInstance> --> Window needed for each of these.
Please bear with me while I'm investigating your issue. I will let you know the progress.
Regards,
-Martin-
New problem...
The binding on the UXDesktop control to the ItemsSource property seems to work sort of, but it doesn't generate full window items. Attached is a test project to show what I mean.
In short, items are generated, but they aren't the expected "Window" looking containters. Instead, they say the name of the object bound in the collection and they have no window header, icon, close button, etc.
After setting some break points in code, I can see that the UXDesktop is creating UXWindowChrome objects by default instead of UXWindow objects. The documentation suggests that the control should generate UXWindow objects because the default target for the ItemContainerStyle is the UXWindow control and not chrome.
How can I control the type of window generated by the UXDesktop control when binding with the ItemsSource property?
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname