I have a normal Button and TextBox in a WPF-Window and I want a Template for the Button with a EventTrigger that listens to Button.Click and then sets a boolean-property of the TextBox. No code-behind.
Something like this:
<ControlTemplate.Triggers>
<EventTrigger SourceName="MyButton" RoutedEvent="Button.Click">
<Setter TargetName="MyTextBox" Property="Focusable" Value="False" />
</EventTrigger>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…