Calling an ElementMethod in a DataTrigger
I have a TextBox thats using this Style. I need to add a Focus() method to in this style.
So that when the TextBox is Visible and the ValidParent Property is false then i call the Focus() method on that TextBox<Style x:Key="ParentTextBoxStyle" TargetType="{x:Type TextBox}">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=ValidParent }" Value="false">
...
</DataTrigger>
<DataTrigger Binding="{Binding Path=ValidParent }" Value="false">
<Setter Property="BorderBrush" Value="Red"/>
</DataTrigger>
</Style.Triggers>
</Style>
Is this possible ?? And if it is then if i had multiple textboxes with the same behaviour which one will recie开发者_开发问答ve Focus?? Does the Order of the Controls in my Xaml make a diffrence then ??
Thank youYou cannot call methods via style triggers. Using Interactivity
from the Blend SDK you have more options, including method calls but they cannot be easily used in styles.
精彩评论