Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cocoa/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Checkbox XamDatagrid UnboundField复选框绑定不起作用_Checkbox_Binding_Xamdatagrid - Fatal编程技术网

Checkbox XamDatagrid UnboundField复选框绑定不起作用

Checkbox XamDatagrid UnboundField复选框绑定不起作用,checkbox,binding,xamdatagrid,Checkbox,Binding,Xamdatagrid,需要帮助。为什么下面的绑定不起作用。我希望在每行数据上都有复选框。当复选框被选中/取消选中时,它应该调用一些事件 <Grid.Resources> <Style x:Key="CheckboxStyle" TargetType="{x:Type igDP:CellValuePresenter}"> <Setter Property="Template"> <Setter.Value&

需要帮助。为什么下面的绑定不起作用。我希望在每行数据上都有复选框。当复选框被选中/取消选中时,它应该调用一些事件

<Grid.Resources>
        <Style x:Key="CheckboxStyle" TargetType="{x:Type igDP:CellValuePresenter}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}">
                         <CheckBox Command="{Binding DataContext.IsCheckedBoolean, RelativeSource={RelativeSource AncestorType={x:Type igDP:XamDataGrid}}}" CommandParameter="{Binding}" />
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
</Grid.Resources>



<igDP:UnboundField Label="Action" Width="auto">
      <igDP:UnboundField.Settings>
            <igDP:FieldSettings CellValuePresenterStyle="{StaticResource CheckboxStyle}" />
       </igDP:UnboundField.Settings>
</igDP:UnboundField>

如果您只想在
复选框上调用一些
命令
,那么我指的是这个,而不是:

<CheckBox HorizontalAlignment="Center" Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type rControl:GridView}},Path=DataContext.ReviewRequiredCommand}"
     CommandParameter="{Binding RelativeSource={RelativeSource Self},Path=IsChecked}"
       BorderThickness="1,1,0,0" BorderBrush="Gray"/>

但是,由于您正在将此
属性
用于
cellValuePresenterStyle
。您将无法确定此
绑定是从哪个
单元格中反映出来的。我希望这对您来说不是问题。):

如果您只想在
复选框上调用一些
命令
,请选中/取消选中
事件

<CheckBox HorizontalAlignment="Center" Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type rControl:GridView}},Path=DataContext.ReviewRequiredCommand}"
     CommandParameter="{Binding RelativeSource={RelativeSource Self},Path=IsChecked}"
       BorderThickness="1,1,0,0" BorderBrush="Gray"/>
但是,由于您正在将此
属性
用于
cellValuePresenterStyle
。您将无法确定此
绑定
是从哪个
单元格中反映出来的。我希望这对您来说不是问题。):

 <CheckBox IsChecked="{Binding DataContext.IsCheckedBoolean, RelativeSource={RelativeSource AncestorType={x:Type igDP:XamDataGrid}}}" />