how to locate the selected item in the datagrid

  • Thread starter Thread starter zbcong
  • Start date Start date
Z

zbcong

hello
when a line in the datagrid is selected,how can i know in the program whick
line is selected(just like that the listview can return the
"selecteditems",but datagrid can't)?

thank you!!
 
hi,

to check if a specific row is selected use the datagrid's "IsSelected"
method. If you want to get all selected rows, you have to loop through all
rows and remember each selected row's index.

Regards,
Stephan
 
Don't you just love inheritance?
this sample inherits from DataGrid and then returns an IList of
SelectedItems.

HTH

Pieter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top