|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
how to locate the selected item in the datagridhello
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 Show quote "zbcong" <congzhe***@capinfo.com.cn> schrieb im Newsbeitrag news:OVOMeYc0EHA.2788@TK2MSFTNGP15.phx.gbl... > 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!! > > Don't you just love inheritance?
this sample inherits from DataGrid and then returns an IList of SelectedItems. HTH Pieter "zbcong" <congzhe***@capinfo.com.cn> wrote in message [attached file: DataGridEx.cs]news:OVOMeYc0EHA.2788@TK2MSFTNGP15.phx.gbl... > 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!! > > |
|||||||||||||||||||||||