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

ControlPanelItem without GridViewSelectColumn

2 Answers 64 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Heiko
Top achievements
Rank 1
Iron
Veteran
Heiko asked on 12 Feb 2015, 07:56 PM
If followed the Telerik ControlPanelItem "Column chooser" example. It works perfect, though now I have two entries for the GridViewSelectColumn and GridViewToggleRowDetailsColumn which I don't want to display. Is there a way to remove those from the columns list?

2 Answers, 1 is accepted

Sort by
0
Accepted
Boris
Telerik team
answered on 13 Feb 2015, 01:05 PM
Hello Neils,

A possible way to remove the GridViewSelectColumn and GridViewToggleRowDetailsColumn columns from the displayed list in the "Column Chooser" dropdown button is to use a convert. For example you can return another collection that excludes the mentioned columns like so:

public class ColumnChooserConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            ObservableCollection<GridViewColumn> otherColumns = new ObservableCollection<GridViewColumn>();
            if (value != null)
            {
                var columns = value as Telerik.Windows.Controls.GridViewColumnCollection;
                 
                foreach (var column in columns)
                {
                    if (!column.GetType().Name.Equals("GridViewToggleRowDetailsColumn") && !column.GetType().Name.Equals("GridViewSelectColumn"))
                    {
                        otherColumns.Add(column);
                    }
                }
                 
            }
 
            return otherColumns;
        }
 
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            // TODO: Implement this method
            throw new NotImplementedException();
        }
    }

I hope this helps.

Regards,
Boris
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.

 
0
Heiko
Top achievements
Rank 1
Iron
Veteran
answered on 13 Feb 2015, 02:46 PM
Thank you, now I get it...
Tags
GridView
Asked by
Heiko
Top achievements
Rank 1
Iron
Veteran
Answers by
Boris
Telerik team
Heiko
Top achievements
Rank 1
Iron
Veteran
Share this question
or