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

Questions about ColumnChooser

2 Answers 70 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Johannes
Top achievements
Rank 1
Johannes asked on 08 Feb 2013, 11:55 AM
First of all I want to say that your documentation about the controls is awesome in most cases  - but when it comes to RadGridView ColumnChooser there are very few information. So here comes my list of questions ;)

1: Get rid of "Close" button
I want to toggle the visibility of my ColumnChooser only via a ToggleButton, nothing else. So how to get rid of the close button in ColumnChooser form border/header?

2: Hide/remove "How to use" text
I want to remove the text in ColumnChooser which tells the user how to use it. If you have many columns in ColumnChooser this text is slighty visible because of the space between the columns. Looks ugly - see attached image 'question2.jpg'.

3: Drag&Drop
When start dragging a column from ColumnChooser to GridView there is an graphical effect, that seems like I can add the column between rows. This looks really confusing and I want to remove this - see attached image 'question3.jpg'.

2 Answers, 1 is accepted

Sort by
0
Accepted
Anton
Telerik team
answered on 13 Feb 2013, 01:15 PM
Hi Johannes,

Thank you for the writing.

In regards to your questions:

1. In order to hide close button you should access it through the Element tree and set it visibility to "Hidden":
this.radGridView1.ColumnChooser.FormElement.TitleBar.CloseButton.Visibility = Telerik.WinControls.ElementVisibility.Hidden;

2. You can set the text with the following code:
this.radGridView1.ColumnChooser.ColumnChooserControl.ColumnChooserElement.Text = "Your text.";

3. For your last case you should subscribe to the PreviewDragOver event of the RadGridViewDragDropService and add the desired condition. For example:
RadGridViewDragDropService dragDropService = this.radGridView1.GridViewElement.GetService<RadGridViewDragDropService>();
dragDropService.PreviewDragOver += new EventHandler<Telerik.WinControls.RadDragOverEventArgs>(dragDropService_PreviewDragOver);

void dragDropService_PreviewDragOver(object sender, Telerik.WinControls.RadDragOverEventArgs e)
{
    if (e.HitTarget is GridHeaderCellElement || e.HitTarget is ColumnChooserElement)
    {
        e.CanDrop = true;
    }
    else
    {
        e.CanDrop = false;
    }
}

Should you have any other questions, I will be glad to assist you.

Regards,
Anton
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
0
Johannes
Top achievements
Rank 1
answered on 14 Feb 2013, 09:29 AM
Hi Anton,

Thank you for your great support, everything works fine.
Tags
GridView
Asked by
Johannes
Top achievements
Rank 1
Answers by
Anton
Telerik team
Johannes
Top achievements
Rank 1
Share this question
or