I'd like to be able to click a textblock and have it run a Command. Is this possible? (if not do I just somehow make a tranparent button over it or something?)
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
You can use a InputBinding.
Edit: Hyperlink is probably worth a mention too.
Well the button would consume your click and the click would not go further to your
TextBlock
. If you don't need that, that would be one way to do it. You can modify the textblock ControlTemplate, and add the button, giving the button a new ControlTemplate with a transparent RectangleT. A nicer solution would be to use a way to hookup commands to events like EventBehavior and put it on theOnMouseLeftButtonDown
event.You do not make a transparent button over it, you put the TextBlock into it: