TextBox
<TextBox>
<TextBox.InputBindings>
<MouseBinding Gesture="RightClick" Command="{Binding MyCommand}" />
</TextBox.InputBindings>
</TextBox>
ListBox
Nuget加载库 System.Windows.Interactivity.WPF
<ListBox x:Name="lst" ItemsSource="{Binding GradeKeChengList}" Grid.Row="1" Grid.Column="0" >
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction x:Name="abc" Command="{Binding YourCommand}"
CommandParameter="{Binding ElementName=lst, Path=SelectedItem}" >
</i:InvokeCommandAction>
</i:EventTrigger>
</i:Interaction.Triggers>
</ListBox>
另一种方式
<!--鼠标左键双击-->
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=Text}" ToolTip="鼠标左键双击,采集本年度!">
<TextBlock.InputBindings>
<MouseBinding Command="{Binding DataContext.SelectListBoxItemCommand, ElementName=mainWin }"
CommandParameter="{Binding ElementName=lst}"
MouseAction="LeftDoubleClick"></MouseBinding>
</TextBlock.InputBindings>
</TextBlock>
</DataTemplate>
</ListBox.ItemTemplate>
博客提及了TextBox和ListBox,还介绍了通过Nuget加载库System.Windows.Interactivity.WPF,同时提到了另一种方式,但未详细说明。这些内容与信息技术中的前端开发相关。
1942





