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
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.