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

use context menu to show and hide columns

11 Answers 350 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Bill
Top achievements
Rank 1
Bill asked on 14 Dec 2009, 05:26 AM

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

11 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 14 Dec 2009, 07:10 AM
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.
0
Bill
Top achievements
Rank 1
answered on 14 Dec 2009, 11:26 AM

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

0
Missing User
answered on 14 Dec 2009, 12:48 PM
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.
0
Bill
Top achievements
Rank 1
answered on 15 Dec 2009, 02:07 PM

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!

0
Missing User
answered on 15 Dec 2009, 02:43 PM
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.
0
Bill
Top achievements
Rank 1
answered on 15 Dec 2009, 07:46 PM

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

0
Accepted
Vlad
Telerik team
answered on 18 Dec 2009, 08:33 AM
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.
0
Shunmuga Priya K
Top achievements
Rank 1
answered on 17 Jan 2012, 04:46 AM
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
0
Maya
Telerik team
answered on 17 Jan 2012, 07:27 AM
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 >>

0
Adhi
Top achievements
Rank 1
answered on 22 Jan 2015, 04:44 PM
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!
0
Stefan
Telerik team
answered on 23 Jan 2015, 05:36 PM
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.

 
Tags
GridView
Asked by
Bill
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Bill
Top achievements
Rank 1
Missing User
Shunmuga Priya K
Top achievements
Rank 1
Maya
Telerik team
Adhi
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or