use context menu to show and hide columns

12 posts, 1 answers
  1. Bill
    Bill avatar
    21 posts
    Member since:
    May 2008

    Posted 13 Dec 2009 Link to this post

    I was reading this thread:

    http://www.telerik.com/community/forums/wpf/gridview/column-chooser.aspx

    Can you please post a working wpf example since I cannot get the code to compile when I replace the rad context menu with the standard windows context menu. Can you please post a working copy using the wpf rad grid view for all of us to use?

    Bill

  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 14 Dec 2009 Link to this post

    Hello Bill,

     Working example can be found here: http://demos.telerik.com/wpf/?GridView/HeaderContextMenu


    Sincerely yours,
    Vlad
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Bill
    Bill avatar
    21 posts
    Member since:
    May 2008

    Posted 14 Dec 2009 Link to this post

    Thanks Vlad  for the reply. Can you please post the source code to this thread as a .zip file?  That way I can download it and see what I am doing incorrectly. For some reason, I cannot find a link to download the sample source code project.

    Thanks.

    Bill

  4. Missing user
    Missing user avatar

    Posted 14 Dec 2009 Link to this post

    Hi Bill,

     I'm attaching a sample project using the code from the online demo for your reference.

    Hope this helps.

    Greetings,
    Anastasia
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Bill
    Bill avatar
    21 posts
    Member since:
    May 2008

    Posted 15 Dec 2009 Link to this post

    Thank you. I am not being clear on what I actually need. Let me try to explain this again.

    The original post that I submitted to this thread had a link to an example project for silverlight. It said to replace the radContextMenu with the windows context menu. This was what I was trying to do and could not get the source code to compile. When I was asking for sample source code on how to perform this task, I was asking if you could please use a normal windows context menu and normal menu item in the sample source code in your project. Can you please post a working sample of this concept using the default windows context menu and default windows menu item?

    Thanks!

  6. Missing user
    Missing user avatar

    Posted 15 Dec 2009 Link to this post

    Hi Bill,

     
    First of all sorry for the misunderstanding.


    I'm attaching a sample application using the default windows context menu and default windows menu item.

    I hope I understood it correctly this time.

    Best wishes,
    Anastasia
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  7. Bill
    Bill avatar
    21 posts
    Member since:
    May 2008

    Posted 15 Dec 2009 Link to this post

    Thank you... we are almost there! I am using an older version of the rad gridview so it does not support some of the newer properties that you are using in your sample source code. The version of the rad gridview that I am using is this:

    v2.0.50727
    2009.1.312.35

    Can you please provide me the source code to accomplish this task using this version of your rad grid view control?

    Thanks!

    Bill

  8. Answer
    Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 18 Dec 2009 Link to this post

    Hello Bill,

     I've attached an example project.


    Greetings,
    Vlad
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  9. Shunmuga Priya K
    Shunmuga Priya K avatar
    12 posts
    Member since:
    Mar 2010

    Posted 16 Jan 2012 Link to this post

    Hi,

    On a button click, is it possible to invoke a telerik datagrid column chooser context menu?   

    A code snipped will be appreciated

    Thanks,
    Priya
  10. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 17 Jan 2012 Link to this post

    Hi Priya,

    I would recommend you to run through this blog post for a reference. 
     

    Greetings,
    Maya
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  11. Adhi
    Adhi avatar
    2 posts
    Member since:
    Sep 2014

    Posted 22 Jan 2015 Link to this post

    Hi, I need an example that explans the context menu to show and hide columns. I need this for Telerik Gridview for WPF. Please let me know. Telerik Demos that installed in my machine is not working. I tried several times and none of the time it worked. Thank you!
  12. Stefan
    Admin
    Stefan avatar
    1073 posts

    Posted 23 Jan 2015 Link to this post

    Hi Adhi,

    In order to add the RadContextMenu to a RadGridView please refer to the Use Rad Context Menu with a RadGridView documentation article. Then you could follow these steps:

    1.   Attach an Event Handler to the ItemClick event of the RadContextMenu:
    <telerik:RadContextMenu x:Name="gridContextMenu"
                            ItemClick="gridContextMenu_Clicked"/>

    2.   Get the clicked Item from the RadContextMenu in the EventHandler method:
    private void gridContextMenu_Clicked(object sender, RoutedEventArgs e)
    {
        RadMenuItem clicked = e.OriginalSource as RadMenuItem;
    }

    3.   Based on the custom logic of your application you can Add or Remove Columns to the RadGridView:
    this.myGridName.Columns.Add(
        new Telerik.Windows.Controls.GridViewDataColumn()
    {
        DataMemberBinding = new Binding("MyPropertyName")
    });
     
    this.myGridName.Columns.RemoveAt(0);

    In addition you can check our Silverlight RowContextMenu online demo. The implementation for WPF is the same.

    Let me know if you need any further assistance.

    Best Regards,
    Stefan
    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.

     
Back to Top