Hi,
I'm trying to make a context menu for a XamDataGrid, but specifically for the section where no rows are. So, if there are any other context menus, such as on the rows themselves or on the column headers (the visibility pane), then these context menus should remain unchanged. When I simply set a ig:ContextMenuService.Manager on the XamDataGrid, this will override the visibility pane on the column headers.
Regards, Stefan
Hello Stefan,
Thank you for your post.
I have been looking into your question. I believe that Krasimir has already provided a solution for this issue. Would you please take a look at the following forum thread: http://ko.infragistics.com/community/forums/p/85970/428947.aspx.
Please do not hesitate to let me know if I have misunderstood your requirements or you have any additional questions on the matter.
Hello Gergana,
The post you refer to is actually one of my own. You are right in saying that Krasimir already helped me so far, but this issue is actually still present in the solution that Krasimir posted. If you open his solution, you will notice that the context menu for the column headers is overriden by the context menu that is intended for the empty-rows area. So, to make it more clear what I need exactly: if you right-clik on the *empty* area (e.g. the area below the row "parent 9"), then the "test root" context menu should pop up just like it does right now. So this part is correct. But, if you right-click the column header (e.g. the header "Name"), the field chooser should pop-up, and *not* the custom context menu. Do you see what I mean?
I have been further researching your issue and have created a small sample application for you.
In the sample application I have created a style for the LabelPresenter and in the style there is an event setter for the PreviewMouseRightButtonDown of the presenter.
In the handler of the event I call the ShowFieldChooser command of the xamDataGrid.
Please find the attached sample application and feel free to let me know if you have any further questions on this matter.
Hi, your sample doesn't have a context menu so you cannot see what I mean. I altered your sample so now there is a context menu. Actually, there are 2: one for the rows, and one for the background (empty area). Now I'm getting strange behavior when right clicking the header. Sometimes, only the field chooser pops up (as it should be), but sometimes both the field chooser AND the context menu pop up...
Also, is there a way to show the field chooser as modal dialog?
And finally, is it possible to place the field chooser next to the column header. The start position seems random.
I have been further researching your issue and have modified the sample application for you. I have added a new command, for the DataRecordPresenter. Then I check if the Record is of type HeaderRecord.
Please find the attached sample application and do not hesitate to let me know if you have any further questions on this matter.
I am glad that you have found a solution to your issue. Please do not hesitate to let me know if you have any further question.
Hi Gergana,
Actually I don't want to open the fieldchooser from a context-menu (as I mentioned in my previous post). I want to open the fieldchooser with a single right mouseclick on the header, without the root context menu disturbing it. But, I have managed to solve this issue myself in the meanwhile. I solved it by creating a Style for the DataRecordPresenter and adding an EventSetter for the PreviewMouseRightButtonUp event. In the event handler, the record type is checked for HeaderRecord, and if so, the e.Handled is set to true (this is the crucial part because it prevents the root context menu from popping up). Finally, the FieldChooser is called manually just like in the post you referred to.
I have been looking into you post. If you want to open the FieldChooser from a ContextMenu I can suggest to take a look at the following link from our forum: http://ko.infragistics.com/community/forums/t/49813.aspx.
Please do not hesitate to let me know if you have any further questions on this matter.
The root context menu and grid items context menu are correct. However, for the header it is the opposite that I want. I do *not* want to see any context menu, but the field chooser, as it normally would. The problem is that the root context menu overrides the field chooser, so it will not be shown. If you remove the header context menu you will see what I mean.
I have made a sample prototype project with classic (non-Infragistics) controls that illustrates what I need. If you right click the green area (empty area), you will see a root context menu. If you right click the blue area (rows area), you will see a row context-menu. If you right click the orange area, you will see the field chooser *without* any context menus interrupting (this is what it is all about).
Note: the orange area field chooser only works on the column headers for the actual columns. So, in order to see the field chooser, you should click one of the 2 first columns, not the 3rd (empty) column.
So, how can I do this with Infragistics?