Home Forums WPF controls Xceed DataGrid for WPF Getting Cell value of selected Row.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #40565 |

    Hi there,

     

    I have displayed data in Xceed  Data Grid  via DataTable.

     DataTable dt = getProfile();

     gridView2.ItemsSource = new DataGridCollectionView(dt.DefaultView); 

     

    I dont want user to make edit the data in the xceed datagrid itself but rather make edit in another window or popup. There is a Column named ID that is unique to each row in the datagrid and the database also so I need the cell value of selected row in another button click event or double click event of grid will also do.  

     I want to do something like this.

    int id = gridView2.SelectedRow.Cells[“ID”].Value; 

     Thanks

    Imported from legacy forums. Posted by Rocky (had 1244 views)

    Fawzi [Xceed]
    Member
    Post count: 722

    Hi Rocky,

    To get the content of a specific cell within a selected row you could do the following:

                DataRowView row = OrdersGrid.SelectedItem as DataRowView;
                List<Object> items = row.Row.ItemArray.ToList();
                Console.WriteLine(OrdersGrid.SelectedItem.GetType() + ”   ” + items[0] + ” ” + items [1]);

    Imported from legacy forums. Posted by Fawzi [Xceed] (had 498 views)

    dar100111
    Participant
    Post count: 11

    Can you only call this by Integer? I want to be able to click on a cell, get the value in the clicked cell or a value in the same row above by Column Name.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.