I have a XamPropertyGrid in an application.When the XamPropertyGrid has focus, it handles the CTRL+S keyboard shortcut to toggle between the Category sort and the Property Sort.
Looking at this reference: https://www.infragistics.com/help/wpf/xampropertygrid-user-interactionsIt does seems that this is possible to configure this key binding by configuring the Visual Appearance on the XamPropertyGrid.
However, I read and re-read the topic: https://www.infragistics.com/help/wpf/xampropertygrid-conf-visualsmany times and I still can't figure how to override this CTRL-S key binding. I see that I can hide the whole "Filter Area" Visual Element, but this is not what I want to do. What I want to do is to support a normal CTRL+S behavior in my application which is to save the document.
Looking at this page: https://www.infragistics.com/help/wpf/17.2/xampropertygrid-visual-elementsit seems that we should be able to reach the "Filter Area" Visual Element somehow, but I can't seem to find how.
We are using version 17.2 of InfragisticsWPF.
Thanks for the help.
Hello Pierre,
I have been investigating this behavior you are referring to, and there does not appear to be a way to shut off this behavior – you can prevent it though. I believe the first documentation article that marked this configurable is likely for the ability to toggle the properties list between alphabetically sorted and category grouped, and this can be done by setting the IsCategorized property between true and false.
In order to prevent this, I would recommend handling the PreviewKeyDown event, and mark it handled in the case that Ctrl is pressed and S is pressed and then carry out your save operations. You can do this using the following code:
private void PropGrid_PreviewKeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.S && (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))) { e.Handled = true; //Do something with Ctrl+S } }
Please let me know if you have any other questions or concerns on this matter.
I agree it is possible to support both KeyBinding using your solution, but it is a little bit heavy to support this as we have to implement the Toggling command ourselves.
Still, we are able to save the document correctly now which was the primary goal.
As a side note: I am not sure that binding the toggling of the sort option is a very good choice considering the Save shortcut is bound to CTRL+S in most applications.
I do agree that Ctrl+S does seem to be a strange combination choice to use for the toggling of this behavior, although I don’t really agree that it would be “heavy” to support the key binding, as this can easily be done by toggling the IsCategorized property to the opposite bool value of what it would be at the time of the key press.