Closed Waiwai-Zhang closed 9 months ago
This is a screenshot of the interface, click on the left blank space there is no response.
By "no response" you mean the dropdown doesn't close? If that's the case i can't reproduce your issue in the showcase application. Could you attach a small repro project then?
I'm sorry I didn't describe it clearly. I'm using MVVM pattern, and use the Microsoft Xaml. Behaviors. The Wpf package help me binding orders. The complete code looks something like this.
`
That's because you are setting the trigger on the textblock, which means it only triggers on the textblock but not it's parent element (MenuItem).
What you have to do is to create an item container style and use that instead of an itemtemplate.
I feel your answer very much and it helps me a lot. From what I looked up, the only way to set events in style is through EventSetter, which doesn't support MVVM, and no solution was found in the forums. Do you have any suggestions?
When you provide the container style you can simply also change it's template ;-) Or if you just want to react to a click you could bind a command from your viewmodel to the menuitem. That's most likely the best solution for MVVM.
Yes, I have rewritten the template of menuitem. Thank you for your help!
As the question, I read template of DropDownButton, but can not find the problem, I think for a long time but can not find a solution. In the blank space of the drop-down box, clicking didn't respond, and I wanted it to. Help me please. The code is as follows.
Environment