I have a WPF Grid, a Combo Box and check box fields as items of the combo box. Combobox items are the grid headers/columns. Currently, the ComboBox is binded to the columns of the Grid and Grid header is toggeled based on the toggling of the checkbox items of Combobox.Now, I have to change this behaviour so that only some fileds are visible on the grid and those which are not visible are availabe in the Combobox as non-selected items with the fields that are visible on the grid as selected items. Toggling the checkbox items in the combobox would toggle the grid header/column visibility. Please suggest.
Grid
-----
<
local:XYZDataGrid
x:Name
=
"dataGrid"
Visibility
=
"Hidden"
ShowGroupPanel
=
"False"
HorizontalAlignment
=
"Left"
VerticalAlignment
=
"Top"
SelectionMode
=
"Extended"
FontSize
=
"10"
SelectionUnit
=
"Cell"
Margin
=
"0,40,0,0"
AutoGeneratingColumn
=
"dataGrid_AutoGeneratingColumn"
CellEditEnded
=
"dataGrid_CellEditEnded"
RowEditEnded
=
"dataGrid_RowEditEnded"
PastingCellClipboardContent
=
"dataGrid_PastingCellClipboardContent"
Sorting
=
"dataGrid_Sorting"
BeginningEdit
=
"dataGrid_BeginningEdit"
CellValidating
=
"dataGrid_CellValidating"
ClipboardPasteMode
=
"SkipHiddenColumns, Default, AllSelectedCells, OverwriteWithEmptyValues"
Pasting
=
"dataGrid_Pasting"
CopyingCellClipboardContent
=
"dataGrid_CopyingCellClipboardContent"
PreviewKeyDown
=
"dataGrid_PreviewKeyDown"
ValidatesOnDataErrors
=
"InEditMode"
ElementExporting
=
"dataGrid_ElementExporting"
>
<
telerik:RadGridView.LayoutTransform
>
<
ScaleTransform
ScaleX
=
"{Binding Path=Value, ElementName=zoom}"
ScaleY
=
"{Binding Path=Value, ElementName=zoom}"
/>
</
telerik:RadGridView.LayoutTransform
>
<
telerik:RadGridView.SortDescriptors
>
<
telerik:SortDescriptor
Member
=
"InformationType"
SortDirection
=
"Ascending"
/>
<
telerik:SortDescriptor
Member
=
"MaterialInformationID"
SortDirection
=
"Ascending"
/>
</
telerik:RadGridView.SortDescriptors
>
</
local:XYZDataGrid
>
ComboBox
---------
<
telerik:RadComboBox
EmptyText
=
"Columns"
ItemsSource
=
"{Binding Columns, ElementName=dataGrid}"
Text
=
"Columns"
Margin
=
"750,10,0,0"
HorizontalAlignment
=
"Left"
VerticalAlignment
=
"Top"
Width
=
"100"
Height
=
"20"
SelectionChanged
=
"RadComboBox_SelectionChanged_1"
>
<
telerik:RadComboBox.ItemTemplate
>
<
DataTemplate
>
<
CheckBox
Content
=
"{Binding Header}"
IsChecked
=
"{Binding IsVisible, Mode=TwoWay}"
/>
</
DataTemplate
>
</
telerik:RadComboBox.ItemTemplate
>
</
telerik:RadComboBox
>