无法在组合框中绑定IsChecked属性

时间:2019-05-23 12:18:49

标签: c# wpf xaml mvvm binding

我在comboBox内有复选框,我无法在CheckBox内绑定IsCheck属性

<CheckBox Content="{Binding .}" IsChecked="{Binding Path=DataContext.IsSystemNameChecked, ElementName=uc, RelativeSource={RelativeSource AncestorType=Window, Mode=FindAncestor}, Mode=TwoWay}"/>
<CheckBox Content="{Binding .}" IsChecked="{Binding DataContext.IsSystemNameChecked, ElementName=uc}"/>
<CheckBox Content="{Binding .}" IsChecked="{Binding IsSystemNameChecked}"/>

<ComboBox ItemsSource="{Binding SystemName}" Grid.Row="4" Grid.Column="1" IsEditable="True" IsReadOnly="True" Text="" >
    <ComboBox.ItemTemplate>
        <DataTemplate>
            <CheckBox Content="{Binding .}" IsChecked="{Binding IsSystemNameChecked}"/>
        </DataTemplate>
    </ComboBox.ItemTemplate>
</ComboBox>

0 个答案:

没有答案