If we can't bind a MouseBinding's Command, what are we supposed to do?

前端 未结 2 1199
醉酒成梦
醉酒成梦 2021-01-13 09:52

I would love to be able to use a regular MouseBinding to capture a CTRL-Click event on my TextBlock. Unfortunately the Command propert

相关标签:
2条回答
  • 2021-01-13 10:06

    You could always take a look at using Attached Command Behaviours.

    0 讨论(0)
  • 2021-01-13 10:07

    Originally I believe I was referring to the use of TextBlock's InputBindings member.

    In .NET 4 InputsBindings now inherit from Freezable, so now the Command property is dependency property (see Binding support in InputBindings), solving the binding issue.

    If you are stuck with .NET 3.5 you could create some attached properties for any type of event that you want. In your OnCommandChanged function add the event handler, and filter based on modifiers (like the Control key or the ClickCount) in your PropertyChangedCallback method.

    0 讨论(0)
提交回复
热议问题