I am working on a WPF windows application and I need a help to solve some problem in it.
I have a data gridview; here is a XML:
<DataGrid x:Name="MyDataGrid" Margin="0,55.333,8,209.692" Width="273.27">
<DataGrid.Columns>
<DataGridTextColumn Header="ID" IsReadOnly="True" Binding="{Binding ID}" Visibility="Hidden" />
<DataGridTextColumn Header="CopID" IsReadOnly="True" Binding="{Binding CopID}" Visibility="Hidden"/>
<DataGridTextColumn Header="CgID" IsReadOnly="True" Binding="{Binding CgID}" Visibility="Hidden"/>
<DataGridTextColumn Header="Item Names" Width="190" IsReadOnly="True" Binding="{Binding ItemName}"/>
<DataGridCheckBoxColumn Header="Select" CanUserReorder="False" />
</DataGrid.Columns>
</DataGrid>
I want to check DataGridCheckBoxColumn CheckBox is true or false in loop
My hope is this to read a Column Value when user click on button; here is the code:
for (int i = 0; i < MyDataGrid.Items.Count - 1; i++)
{
/*Some code here for Check CheckBox True or False*/
for (int j = 0; j < MyDataGrid.Columns.Count; j++)
{
string Massage = (MyDataGrid.Items[j] as DataRowView).Row.ItemArray[3].ToString();
MessageBox.Show( Massage);
}
}
I want to check CheckBox is true or false in the loop to get value of that row Columns where is CheckBox is checked I hope somebody can help me
to compete my code which I have done give up. I want this code to work when user click on button because I have to save record with this loop in database where CheckBox is true in MyDataGrid.
And I also want to select all check box of datagrid when I will check the CheckBox call Select All.
I hope some buddy help me in it as soon as possible
Thank You