[DevExpress Support Team: CLONED FROM S173664: How to refresh View appearance after making changes to the Application Model in code]
If you invoke the SwitchMasterDetailMode action from the context menu (WinForms), the context menu stays open
The context menu invoked for WinForms ListEditor is not closed after reloading View controls from the Application Model (S173664) from SingleChoiceAction with ItemType = ItemIsMode
Answers approved by DevExpress Support
Thank you for your feedback.
I have investigated your project and found that in your configuration, an end user will expect that the shown popup menu will be hidden immediately when a ComboBox editor value is changed.
Unfortunately, we have not investigated this configuration and don't have a built in option to enable this behavior. We will see how to improve this situation, though I cannot promise any time frame.
Currently, I suggest that you manually hide the shown popup menu:
C#Private Function SetMasterDetailKind(tKind As ajmMasterDetailKindNr) As Boolean
Try
Dim tView As ListView = View
Dim tModel As IModelListView = tView?.Model
Dim tCurrent = tView.CurrentObject
If Not Frame.SetView(Nothing, True, Nothing, False) Then
Return False
Else
Dim contextMenuHolder As IContextMenuHolder = TryCast(Frame.Template, IContextMenuHolder)
If contextMenuHolder IsNot Nothing And contextMenuHolder.ContextMenu IsNot Nothing Then
contextMenuHolder.ContextMenu.HidePopup()
End If
See the attached project for a complete solution.
Hello Andreas,
Would you please help me replicate this behavior with our MainDemo or another test app? I performed tests under various UI configurations and it all worked fine. Please refer to the attached video to see my steps. I am looking forward to hearing from you.
Hello Dennis,
thanks for checking, attached a sample project, just start and run.
Hello Andreas,
Thanks for making this sample.
I can replicate this behavior, because I used SimpleAction while you are doing it with SingleChoiceAction, which creates another drop-down sub-menu from the context one.
Good news is that there is a temporarily solution with ItemType = ItemIsOperation. Anyway, we will research this situation and see if this can be easily improved with or without writing platform-dependent code. This appears to be a tricky problem related to the WinForms framework and our XtraBars library controls, so our research can take significant time. Your patience is greatly appreciated.
Hello Dennis,
yes,but this controller was working for years. Since the code was somewhat like a hack, I thought it might be a good idea to use now this official approach. Before it was:
- Store current object
- Update model
- If View.IsRoot
Frame.SetView(Application.ProcessShortcut(Frame.View.CreateShortcut()), true, Frame)
else
View.LoadModel()
- Restore current object
It was not perfect, but there was no flicker and the context menu was closed. Maybe this info helps also.
Thanks for your update, Andreas.