User Profile & Activity

Chris Swain Member
Page
of 3

I actually ended up going with this solution so that I could allow developers creating apps to run on my platform's virtual desktop to specify their own INavigationContentLoader for the UXNavigationWindow.  Now, one app can launch a UXNavigationWindow and use the default behavior for navigating, while another app can impelemnt their own way of handling navigation within their window. 

I just added an INavigationContentLoader parameter to the constructor for my custom UXNavigationWindow.  The I set the Navigator.ContentLoader property to the value of the parameter. 

Actually, here is what I'm doing:

  1. First, I created my own implementation of the INavigationContentLoader.
  2. Next, I created a Xaml Style for the UXFrame and set the ContentLoader property to my implementation.
  3. Finally, I set the NavigatorStyle to the style for the UXFrame.

Now I can step into my custom content loader and handle loading of navigation items according to my custom implementation.  I'm not using the application framework the way the ClientUI does.  I have my own Prism based solution.  I'm tracking all of my application instances in a custom application manager and that ultimately serves as the data source for my UXDesktop.  My application is strictly limited to SL4.  We may modify it in the future for WP7, but that won't be for some time and will likely not include the desktop paradigm (which uses the custom navigation). 

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. 

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. 

Here is a simplified psuedo code example:

//This class is the item bound to the window from the ItemsSource
public class WindowItem

{

bool IsNavigationWindow {get;set;}

}

//This is the custom implementation of the UXDesktop
public class MyCustomDesktop : UXDesktop

{

//This enumeration defines the types of windows supported
public enum WindowType

{

Window,

NavigationWindow,

ChromeWindow

}

//This keeps track of the type of window to be generated next
private WindowType NewWindowType = WindowType.Window;

protected override bool IsItemItsOwnContainer(object item)

{

if (item is WindowItem)

{

if (((WindowItem)item).IsNavigationWindow)

{

NewWindowType = WindowType.NavigationWindow;

}

else

{

NewWindowType = WindowType.Window;

}

}

return base.IsItemItsOwnContainerOverride(item);

}

protected override DependencyObject GetContainerForItmeOverride()

{

UXWindow newWindow = null;

if (NewWindowType == WindowType.NavigationWindow)

{

newWindow = new UXNavigationWindow();

}

else

{

newWindow = new UXWindow();

}

...

}

}

Thanks.  Let me know as soon as you have a solution as my project is in urgent need of this capability. 

Any idea if this is possible?  Do I need to use a custom ItemsContainerGenerator or something?

Posted: December 8, 2010 10:16 AM

That looks like a good solution for handling the layout arrangement, but what fires that command by default?

Thanks.  Hopefully this will get a patch soon.  In the meantime, I can make do by binding to the WindowCommands as the post below describes:

http://www.intersoftpt.com/Community/ClientUI/Handling-WindowCommands-like-Close-Minimize-and-Maximize/

Posted: December 7, 2010 10:39 AM

I was trying a similar thing with capturing the Close command and couldn't get it to work.  I posted this question on the Developer Network.  The same concept applies to this.  See my question and sample code below:

I'm using the UXDesktop control bound to an ItemsSource to generate my UXWindow objects.  I need to be able to handle some of the commands fired by the windows such as Close, Minimize and Maximize.  I've tried the following, but it doesn't seem to capture the Close command when I click the close button of the UXWindow object.

 

    public partial class RootView : ViewBase
    {
        public RootView(RootViewModel viewModel)
            : base(viewModel)
        {
            InitializeComponent();
            CommandBinding windowCloseCommandBinding = new CommandBinding(WindowCommands.Close, HandleWindowClose);
            // Create the CommandBindingCollection to hold the command binding
            CommandBindingCollection bindingCollection = new CommandBindingCollection();
            bindingCollection.Add(windowCloseCommandBinding);

            // Set the binding collection to the layout root
            CommandManager.SetCommandBindings(this, bindingCollection);
        }

        private void HandleWindowClose(object sender, ExecutedRoutedEventArgs e)
        {

        }
    }
How can I capture and handle the commands fired from my UXWindow objects in my UXDesktop?

The problem is that I need to use the UXDesktopDock control or the UXDock control for the rich "Fish Eye"-like functionality.  I am successfully using the UXDesktopDock now to show an "Applications" menu at startup and to display application instances grouped together on the taskbar like Windows 7 does. 

Is there a way to override the minimize/maximize functionality of the UXDesktopDock or UXDock control so I can handle them the way I want?

All times are GMT -5. The time now is 1:55 PM.
Previous Next