XamDataGrid ColumnChooser Implementation

This is a frequently asked scenario with the XamDataGrid. This is why I will be showing one way of how to enable a Column Chooser for your XamDataGrid.

I have created a class ColumnChooserManager, which will create a small column chooser control and display it when you right click on the Field's Label. The ColumnChooser control is bound to a partucular XamDataGrid's FieldLayouts collection. It works with flat as well as hierarchical data structure, so that you can choose to show / hide fields from different layouts. Because of the fact that the FieldLayouts are generated when they are expanded, you will be able to see a particular field layout only when it is expanded.

Enabling the column chooser is very easy - just target the XamDataGrid -

MyUtilities.ColumnChooser.ColumnChooserManager.EnableColumnChooser(xamDataGrid1);

As you can see on the screenshot, the NestedData field is in the nested layout. When you expand any record, you will be able to select that nested layout throught the ComboBox of the ColumnChooser control.

The visual design looks choppy because I have almost no sense of look and feel, and I will leave that to you.

I will post the MyUtilities.dll project file in another blog post and will update it regularly with the new added contents.


Comments  (4 )

nmuthu
on Mon, Aug 10 2009 9:59 PM

Could you please share the source code of MyUtilities.Dll

okkesemin
on Sat, Nov 7 2009 7:56 AM

yes could you please share it ?

okkesemin
on Tue, Nov 10 2009 12:37 AM

this implementation can not be used without myutilities.dll s source code I think.

John Doe
on Wed, Dec 9 2009 3:21 AM

Add a Comment

Please Login or Register to add a comment.