Quantcast
Channel: CSharp Forum Latest Questions
Viewing all articles
Browse latest Browse all 32120

WPF data Grid View.

$
0
0
Hello guys, 

I am working on WPF windows application i need a help to solve some problem in it. 
I have a data gridview here is a XML Code:

<DataGrid x:Name="MyDataGrid" Margin="0,55.333,8,209.692" HorizontalAlignment="Right" 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 lope is this to read a Column Velue when user click on button here is a code:
 
for (int i = 0; i < MyDataGrid.Items.Count - 1; i++)
                {
                    for (int j = 0; j < MyDataGrid.Columns.Count; i++)
                    {                        
                        string Massage = (MyDataGrid.Items[i] as DataRowView).Row.ItemArray[3].ToString();
                        MessageBox.Show( Massage);
                    }
                }        

i want to check CheckBox is true or false in the loop to get velue of that row Columns where is CheckBox is checked i hope some buddy help me
to compete my code which i have done give up. i want this code work when user click on button because i have to save record with this loop in database 
where CheckBox is true in MyDataGrid.

Thank you hope some buddy help me in it...






Viewing all articles
Browse latest Browse all 32120

Trending Articles