如何点击该按钮,然后将Value
txtNoOfVehicles
设为NULL
或""
?
<dxg:GridControl ItemsSource="{Binding ShiftEntries}">
<dxg:GridControl.Columns>
<dxg:GridColumn Header="No. of Vehicles">
<dxg:GridColumn.CellTemplate>
<DataTemplate>
<StackPanel>
<dxe:TextEdit x:Name="txtNoOfVehicles" Text="{Binding RowData.Row.NoOfVehicles}" Mask="\d{1,4}" MaskType="RegEx" NullText="Infinity" NullValue="{x:Null}" AllowNullInput="True" ShowError="False" />
<Button Content="Infinity" Margin="3" />
</StackPanel>
</DataTemplate>
</dxg:GridColumn.CellTemplate>
</dxg:GridColumn>
</dxg:GridControl.Columns>
</dxg:GridControl>
我研究了样式/数据/事件触发器,但我看到的所有示例都针对应用了触发器的相同控件。我想点击按钮触发,目标是Text
的{{1}}属性。
我试过:
TextEdit
答案 0 :(得分:1)
要回答你的问题,你可以做这样的事情
<StackPanel>
<TextBlock Name="Block" Text="Test" />
<Button Name="btn">
<Button.Triggers>
<EventTrigger SourceName="btn" RoutedEvent="Button.Click">
<BeginStoryboard>
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Block"
Storyboard.TargetProperty="Text"
>
<DiscreteObjectKeyFrame Value=""></DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Button.Triggers>
</Button>
</StackPanel>