Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1590
Different context menus in the same xamDataGrid
posted

Hi,

I have a xamDataGrid in which I show master/detail data to the user. When the user right clicks the grid, the user should have some context menu options. However, the exact options depend on where the user clicks. There are 3 possibilities. Either the user clicks (1) a header row, (2) a detail row, or (3) the empty grid area (where there aren't any rows). Also, these 3 possibilities execute a different command on the viewmodel, and when the user clicks either a header or detail row, the menu items should pass the clicked row's data item as command parameter.

I was already able to accomplish this functionality using classic WPF context menus, but now we want to use the IG context menu so it all blends in the same theme style. But I can't get it working using IG controls. In the old situation I set 1 context menu on the grid itself, and another on a Style for DataRecordCellArea (actually, that one would determine the type of data in the row and choose between one of 2 context menus that were defined as resource).

I've been searching for a solution using IG controls, and I already read this post:

http://ko.infragistics.com/community/forums/t/58709.aspx 

And even though maybe I could solve it using the ContextMenu events, I would prefer not using any code-behind. I didn't need code behind before either. So, is there a pure XAML way of solving this?

If I'm not clear enough in my description, please just say so and I will elaborate.

Regards, Stefan