Toggle Grid columns/headers based on ComboBox CheckBox Items

2 posts, 0 answers
  1. Bobby
    Bobby avatar
    1 posts
    Member since:
    Apr 2014

    Posted 15 Apr 2014 Link to this post

    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}" />

  2. Yana
    Yana avatar
    4547 posts

    Posted 17 Apr 2014 Link to this post

    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.

  3. DevCraft R3 2016 release webinar banner
Back to Top