ListBox中的WPF鼠标绑定

时间:2014-08-28 08:14:11

标签: wpf xaml data-binding listbox

我有这个代码,我想添加鼠标左键单击绑定。 我已经这样做了,但由于某种原因接缝已经生效了。

<ListBox Grid.Row="5" Grid.Column="2" IsEnabled="{Binding UserGroupUpdatePermission}" ItemsSource="{Binding UserGroupTypeList }" HorizontalAlignment="Left" VerticalAlignment="Center" VerticalContentAlignment="Center" Width="300" Height="auto">
    <ListBox.InputBindings>
        <MouseBinding Command="{Binding Path = SaveCommand }" Gesture="LeftClick" />
    </ListBox.InputBindings>
    <ListBox.ItemTemplate>
        <DataTemplate>
            <CheckBox Content="{Binding Name}" IsChecked="{Binding Checked, Mode=TwoWay}"/>
        </DataTemplate>
    </ListBox.ItemTemplate>
</ListBox>
我做错了吗?这样做有什么外在的方式吗?

0 个答案:

没有答案