User Profile & Activity

Chris Swain Member
Page
of 3

Any suggestions?

Posted: December 4, 2010 8:44 AM

Any ideas?

Posted: December 3, 2010 12:59 PM

I came up with a better answer, I think. 

I'm attaching to the ItemBound event of the UXDesktopDock control. 

In the event handler, I'm attaching to the StackOpened event of the UXDesktopDockButton item that was just bound. 

In the StackOpened event handler, I'm looping through the Items collection and using the bound data to build a window name string to be used by the UXDesktop.FindWindow(windowName) method to get the associated window. 

Then I call the GetThumbnail(false) method to get the thumbnail imagesource and assign it to a property of my bound data item called Thumbnail. 

End result - When the stack of instance items is opened from my UXDesktopDockButton, I find the associated window for each UXStackItem, get the thumbnail, and set the Thumbnail property for the data item in the DataContext of the UXStackItem. 

This ensures that I get the latest thumbnail to show every time I display the task bar instance items. 

Posted: December 2, 2010 10:29 AM

Thanks.  I came up with the solution by monitoring the LayoutUpdated event of the window and doing some checking to see if a thumbnail needs to be generated.  If so, then I call the GetThumbnail method and assign the imagesource to my taskbar sub-item.  I'm sure I'll need to do more optimization, but it's working. 

Posted: November 30, 2010 2:33 PM

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?

Posted: November 30, 2010 10:42 AM

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. 

Posted: November 29, 2010 10:07 AM

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.

                -Name property

                -Icon property

Posted: November 25, 2010 9:26 AM

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. 

Posted: November 24, 2010 3:43 PM

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?

Posted: November 24, 2010 1:11 PM

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. 

All times are GMT -5. The time now is 1:20 AM.
Previous Next