Microsoft.Windows.Controls.ribbon.ribbonwindow encounters a strange phenomenon of Avalondock

Part One

When he entered the current company at the end of 2014, the leader was preparing to develop a new software platform to replace the original one. The original platform uses C++Build development interface (window c/s client) and Visual Studio (package dll module). After the New Year, the leader has completed the framework (the leader worked overtime during the New Year ^_^ ). At that time, a rookie (now an old bird), the new framework uses wpf mode, RibbonWindow (interface function buttons) + AvalonDock (interface layout, flexible and easy to use), of course, the tool is the latest Visual Studio 2013. Although using wpf to develop, but the PC software customers do not care about the beauty of the UI, only to see whether the function is powerful. Therefore, I just encapsulated common controls such as checkbox and Text for my own call according to online materials, and did not continue to study the direction of custom controls. The most used is to develop some business logic with the MVVM model. Binding is really easy to use, data transmission between View and ViewModel does not require writing code. When the demand changed, the workload was greatly reduced, and we entered a new society from then on. Not much nonsense, let’s get to the main topic

In the middle of 2016, testers reported that some input controls on the interface could not respond to keyboard input when the software was inexplicable. After receiving the feedback, we immediately investigated and analyzed.
1. It is suspected that the keyboard message is not delivered to the software, but when the phenomenon occurs, some controls can be input, and some cannot be input, and face immediately after every minute;
2. Because the controls that cannot be input are not provided by wpf itself, they are some Controls in the windows encapsulated by mfc or referenced winform controls such as DataGridView, at this time, suspect the compatibility reasons, read the official Microsoft information, add in front of the window

System.Windows.Forms. Integration.ElementHost.EnableModelessKeyboardInterop(this)

Still unable to solve the problem. In the end, the problem was temporarily shelved due to insufficient capacity. A temporary solution was adopted to add a keyboard input window. When the problem occurs, the keyboard input window is called to input information.

As time goes by, I have changed from a rookie to an old rookie, but the question has been lingering in my mind, mocking me ruthlessly, naibi! ! !

Part two

In April 2018, I looked back on this issue, mainly looking at the open source source code in order to solve the problem. I accidentally discovered the cause of this phenomenon.

1. Click the RibbonSplitButton button once, the drop-down menu will pop up, and click the drop-down menu again to retract it. Cannot enter information at this time

2, click the RibbonSplitButton button once, the drop-down menu will pop up, and then click elsewhere. Cannot enter information at this time

3. Click the RibbonSplitButton button once. You can enter information at this time.

Please see the picture below, and the operation steps should be carried out according to 1, 2, and 3.

Share pictures

I can reproduce the problem, and suddenly I feel hope is right in front of my eyes. Is it caused by the RibbonSplitButton control, replaced with RibbonMenuButton, the result is still the same. Is it possible to rewrite a control? Put this plan to the end, and think about other ideas. The new test code in the company couldn’t be tested. I rebuilt a new project on my computer at the weekend. However, no matter how you click, you can always type. Could it be caused by other bugs in our platform? Oh my god, the platform has been developed for more than 3 years, how can I find the problem and eliminate it one by one module? In the end, everyone’s painstaking efforts will pay off, and the effort will be rewarded. I found that the RibbonWindow in my new project is not the same as the company. The company quoted Microsoft.Windows.Controls.Ribbon.RibbonWindow, and I quoted System.Windows.Controls.Ribbon.RibbonWindow.

?

Part Three

? Victory is here, quickly re-create two projects and quote Microsoft .Windows.Controls.Ribbon.RibbonWindow and System.Windows.Controls.Ribbon.RibbonWindow, the rest of the code remains unchanged. The result quoted Microsoft.Windows.Controls.Ribbon.RibbonWindow showed that the keyboard could not be input, and the other was normal.

Notes

The problem can only be temporarily solved. The reason for the occurrence of the Microsoft.Windows.Controls.Ribbon.RibbonWindow library is not clear . Did not continue to follow. I am going to submit this question on stackoverflow. I am still studying how to create a new question. The head is big…

Test code

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 5577 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.