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 have found the most peculiar bug when developing my WPF application and I am able to reproduce in the sample I am sending you. It occurs as follows:
Using the sample application built you click on contacts the contacts.xaml UXPage is displayed in the Content Panel. On the page is a dialog button that when clicked will display a dialog box called DialogBox1. On the dialog box is a UXComboBox which displays a list of products. If you click on an item in the combo box, it displays a MessagePresenter popup that says "Made it". The Message box displays properly on top of dialog box but a breakpoint in the MessageBoxServiceProivder class at the following line says that the logical container of the Message box is MainPanel which is incorrect the logical container should be Dialog Box1
DependencyObjectlogicalContainer=ISFocusManager.GetLogicalContainerScope(element);
I then placed a button on DialogBox1 which when clicked opens up a second dialog box. On this dialog box is the exact same combobox. When I click on an item I pop up a Message box saying "Made it". A breakpoint also says the logical container is MainPage which is incorrect it should now be DialogBox2. This time the Message box appears behind Dialog box2 which is wrong as it should appear on top of dialog box 2.
If i place buttons on the dialog boxes and pop up a message when the buttons are clicked the logical container is correctly shown as the dialog box and the message box is correctly displayed on top of the appropriate dialog box. So there seems to be an issue with the UXComboBox and the Dialog box as to the logical container of the UXComboBox
Thank you for the detail description regarding the reported problem.
I try to summarize the problem and come up with the following resume.
When a MessagePresenter is shown, the owner is defined by executing following line.
FrameworkElement element = ISFocusManager.GetFocusedElement() as FrameworkElement; // check if the caller is hosted within a known container // if the dependency container is of IWindow type, use it as the owner of this modal window if (element != null) { DependencyObject logicalContainer = ISFocusManager.GetLogicalContainerScope(element); if (logicalContainer is IWindow) _owner = logicalContainer as IWindow; }
The owner is determined by getting the focused element. In the above scenario, the focused element after user selects an item from UXComboBox is the scroll viewer of UXComboBox’s result box. However, this element does no longer exist in the view – just after user selects an item, the result box of UXComboBox is collapsed.
It seems that when the focused element doesn’t exist in the view, GetLogicalContainerScope() method tries to look up from its parent. Please correct me if I’m wrong.
So I created a workaround for such behavior. In the MessageBoxServiceProvider class, I added a setter for Owner property so that the Owner property now looks like following snippet code.
public static IWindow Owner { get { FrameworkElement element = ISFocusManager.GetFocusedElement() as FrameworkElement; // check if the caller is hosted within a known container // if the dependency container is of IWindow type, use it as the owner of this modal window if (element != null) { DependencyObject logicalContainer = ISFocusManager.GetLogicalContainerScope(element); if (logicalContainer is IWindow) _owner = logicalContainer as IWindow; } return _owner; } set { _owner = value; } }
In DialogBox1EditViewModel class, I set the Owner property in AddAnotherDialogBox execute method as shown in the following snippet code.
public void AddAnotherDialogBox(object parameter) { var vm = new DialogBox2EditViewModel(); DialogBoxServiceProvider.GetInstanceAsync( DialogBoxServiceProvider.DialogBox2EditView, dialogBox => { dialogBox.DataContext = vm; MessageBoxServiceProvider.Owner = dialogBox; DialogBoxServiceProvider.Show(dialogBox, null); }); }
By using this workaround, now the MessagePresenter popup on top of the UXDialogBox2.
I enclosed the modified project as attachment. Please feel free to let me know if you have different result or if I mistakenly understanding about the reported problem.
Thank you very much!!!! that works perfectly. Just another reason why Intersoft is the #1 .net controls provider. Not only is the product great and easy to use, the support is fantastic and fast.
Bill
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