Questions about ColumnChooser

3 posts, 1 answers
  1. Johannes
    Johannes avatar
    66 posts
    Member since:
    Dec 2012

    Posted 08 Feb 2013 Link to this post

    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. Answer
    Anton
    Admin
    Anton avatar
    167 posts

    Posted 13 Feb 2013 Link to this post

    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.
  3. Johannes
    Johannes avatar
    66 posts
    Member since:
    Dec 2012

    Posted 14 Feb 2013 Link to this post

    Hi Anton,

    Thank you for your great support, everything works fine.
Back to Top