我有一个问题。我创建了一个RichTextBox XAML(没有.text属性的那个,因为它似乎有两个不同的)。现在我想在文本框被聚焦时从我的.cs中调用一个函数,而当它失去焦点时我想调用另一个函数。 我已经想通了,如何触发这样的动画:
<Style x:Key="adressBar" TargetType="{x:Type RichTextBox}">
<Setter Property="Background" Value="transparent"></Setter>
<Style.Triggers>
<Trigger Property="IsFocused" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<ColorAnimation Duration="0:0:0.2" Storyboard.TargetProperty="(TextBox.Background).(SolidColorBrush.Color)" To="#FFF5F5FE" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<ColorAnimation Duration="0:0:0.2" Storyboard.TargetProperty="(TextBox.Background).(SolidColorBrush.Color)" To="transparent" />
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
</Style.Triggers>
</Style>
但我不知道如何在那里调用一个函数。 该功能基本上如下所示:
public void doStuff(){...}
我不需要解析参数! :)
答案 0 :(得分:0)