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

Toggle Grid columns/headers based on ComboBox CheckBox Items

1 Answer 25 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Bobby
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.

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>


1 Answer, 1 is accepted

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

I would suggest that you check the following help topic:
http://www.telerik.com/help/wpf/radcombobox-howto-enable-disable-radcombobox-items.html -
it explains how you could enable/disable the items of RadComboBox.

Hope this will help.

Regards,
Yana
Telerik
 

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.

 
Tags
General Discussions
Asked by
Bobby
Top achievements
Rank 1
Answers by
Yana
Telerik team
Share this question
or