Sunday, 15 July 2012

c# - When I use DataGridRow for Getting data from selected row content, Null data is returned always -


I use the WPF metro datagrid when I use DataGridRow to get data from the selected row content Always tap data returns to var 'rowview' What is my problem?

This is my code.

  Private Zero DataGrid_MotionDoubleClick (Object Sender, MouseButton Event Ergon E) {IInputElement element = e.MouseDevice.DirectlyOver; If (Element! = Null & Element is Framework Element) {If ((Framework Element) element) Parents DataGridCell is {DataGrid Grid = DataGrid as Sender; if (Grid! = Null & Grid Selected items! = Null & grid. Selected items number == 1) {DataGridRow rowview = grid. ITM as selected DataGridRow; if (line view! = Null) {ProjectInfo addJobWindow = New ProjectInfo () ; AddJobWindow.ShowDialog ();}}}} DataGrid x: name = "DgProjectInfo" ItemSource = "{binding project}")  

auto generated column = "incorrect" Margin = " - 11,11,211, -1 "MouseDoubleClick =" DataGrid_MouseDoubleClick "IsReadOnly =" True ">

You can not change the grid.View of selected gateway To get the DataGridRow datagrid line in, see the code below.

DataGridRow rowview = (DataGridRow) grid. ItemContainerGenerator.ContainerFromIndex (grid.SelectedIndex);

No comments:

Post a Comment