wpf 任意控件绑定Command
<Border Background="White"
BorderBrush="Gray"
BorderThickness="1"
CornerRadius="2">
<Border.InputBindings>
<MouseBinding Command="{Binding DataContext.BorderCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}}"
CommandParameter="{Binding}"
MouseAction="LeftClick" />
</Border.InputBindings>
</Border>

浙公网安备 33010602011771号