Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1155
How to get all cells from one field?
posted

Hi,

I use the mouse right click to select one field(column) by the following codes:

private void xamDataGrid1_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)        

 {             var labelPresenter = Infragistics.Windows.Utilities.GetAncestorFromType(e.OriginalSource as DependencyObject, typeof(LabelPresenter), true);

             if (labelPresenter != null)            

{                 var clickedFieldName = ((DataItemPresenter)labelPresenter).Field.Name;                

var field = xamDataGrid1.FieldLayouts[0].Fields[clickedFieldName];

                xamDataGrid1.SelectedItems.Cells.Clear();                

xamDataGrid1.SelectedItems.Fields.Clear();                

 xamDataGrid1.SelectedItems.Fields.Add(field);            

 }        

}

From the UI, all the cells under the field has been in selected mode, from the codebehind I can't get all selected cells from the xamDataGrid1.SelectedItems.Cells.

Could you please help on how to get all cells for the selected field?

Thank you!