How to set and focus the SelectedPropertyItem to edit mode programmatically

When setting the SelectedPropertyItem from code how do we focus the editor and have the editor in input mode with the keyboard focus set to it?

Example:

The property item editor is a TextBox editor, and the goal is to set the SelectedPropertyItem from code and to set the keyboard focus to the TextBox editor with the carret being in the input position.

We tried:

FrameworkElement editorElement = (FrameworkElement)item.PropertyEditor;
FocusManager.SetFocusedElement(MyPropertyGrid, editorElement);
Keyboard.Focus(editorElement);

The focus is set to the selected property item but the TextBox does not show the input carret.
If we input text the TextBox is then receiving the input focus from the property grid and the carret is showing up then upon keyboard input.

For our use case that is not intuitiv, so our question is how can we set the property editor to "edit" mode to have the input carret showing as feedback that the property is now ready to receive input?

Thanks a lot.


1 Reply

SN Sudharsan Narayanan Syncfusion Team October 21, 2021 03:42 AM UTC

Hi Michael,

Thanks for contacting Syncfusion Support,

We have checked the reported query that “Set focus to SelectedPropertyItem Programmatically” from our end. We have prepared the sample by using Focus Manager in our custom Editor. So that the Editor got focus When we initiate the Property Grid. So please find the sample from the below location,

Sample: https://www.syncfusion.com/downloads/support/forum/169764/ze/TestApp1128552522

Please check the sample and let me know your concerns. If we are misunderstood the query, Please modify the provide sample with reproducible the issue and revert to us. It will helpful to prompt the solution as earlier.

Regards,
 
Sudharsan

Loader.
Up arrow icon