This is a migrated thread and some comments may be shown as answers.

Toggle Grid columns/headers based on ComboBox CheckBox Items

1 Answer 63 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Bobby asked on 15 Apr 2014, 10:31 AM
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.

<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">
                    <ScaleTransform ScaleX="{Binding Path=Value, ElementName=zoom}" ScaleY="{Binding Path=Value, ElementName=zoom}" />
                    <telerik:SortDescriptor Member="InformationType" SortDirection="Ascending"/>
                    <telerik:SortDescriptor Member="MaterialInformationID" SortDirection="Ascending"/>

<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">
                        <CheckBox Content="{Binding Header}"
                          IsChecked="{Binding IsVisible, Mode=TwoWay}" />

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 17 Apr 2014, 11:20 AM
Hi Bobby,

I would suggest that you check the following help topic: -
it explains how you could enable/disable the items of RadComboBox.

Hope this will help.


Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

General Discussions
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question