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
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?
You can run the attached sample project to see that the HandleWindowCommand method is never invoked even though I'm doing the CommandBinding to the WindowCommands.Close and Minimize commands.
In such scenario, you will need to bind the CommandBindingCollection object to the element which implements the command.
In your attached sample, the element which has the minimize and close command is UXWindow so you will need to bind the CommandBindingCollectionto UXWindow. Here is the snippet:
public class SymphonyUXDesktop : UXDesktop{ protected override DependencyObject GetContainerForItemOverride() { UXWindow newWindow = new UXWindow(); newWindow.IsClientVisible = true; newWindow.CanMaximize = true; newWindow.CanMinimize = true; newWindow.CanMove = true; newWindow.CanResize = true; CommandBinding windowCloseCommandBinding = new CommandBinding(WindowCommands.Close, HandleWindowCommand, CanHandleWindowCommand); CommandBinding windowMinimizeCommandBinding = new CommandBinding(WindowCommands.Minimize, HandleWindowCommand, CanHandleWindowCommand); CommandBindingCollection bindingCollection = new CommandBindingCollection(); bindingCollection.Add(windowCloseCommandBinding); bindingCollection.Add(windowMinimizeCommandBinding); CommandManager.SetCommandBindings(newWindow, bindingCollection); return newWindow; } private void HandleWindowCommand(object sender, ExecutedRoutedEventArgs e) { } private void CanHandleWindowCommand(object sender, CanExecuteRoutedEventArgs e) { e.CanExecute = true; }}
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