mardi 30 novembre 2021

Set value of DataGrid cell when CheckBoxColumn in same row is checked

I've a DataGrid with several columns, one of which is a CheckBoxColumn. When the CheckBox is checked, I want to set the value of another cell in that DataGrid row (column "Verifisert").

How can I do that? Whether it is done in code-behind or not, is irrelevant to me.

<DataGrid x:Name="dg_preview_invoice"                
                    AutoGenerateColumns="False">                   
    <DataGrid.Columns>      
        <DataGridCheckBoxColumn Width="*" HeaderStyle="{StaticResource CenterGridHeaderStyle}"
                                            Binding="{Binding IsChecked, UpdateSourceTrigger=PropertyChanged}">
           
            <DataGridCheckBoxColumn.Header>

                <CheckBox x:Name="cbc_check_all" HorizontalAlignment="Center"
                                      IsChecked="False" Checked="{s:Action CheckAllPreviewInvoices}"
                                      Unchecked="{s:Action UncheckAllPreviewInvoices}"></CheckBox>
            </DataGridCheckBoxColumn.Header>
        </DataGridCheckBoxColumn>

        <DataGridTextColumn Header="Verifisert" Width="95"
                                        HeaderStyle="{StaticResource CenterGridHeaderStyle}"
                                        Visibility="Hidden"/>

    </DataGrid.Columns>
</DataGrid>



Aucun commentaire:

Enregistrer un commentaire