Setting SelectAllOnGotFocus globally for all editors in the PropertyGrid

Aug 28, 2012 at 9:07 PM

When you define an EditorTemplate for a custom EditorDefinition using one of the NumericUpDown editors, there is a SelectAllOnGotFocus property which can be set to true so that the data in the property item is selected when you tab into that item. 

Is there a way to set this behavior globally on the property grid (e.g. to have all text selected when you tab into a string field, etc)? 



Aug 29, 2012 at 12:47 PM

You could set a default editor definition for all "string" type, and use the WatermarkTextBox that support the SelectAllOnGotFocus feature:


                  <xctk:EditorDefinition TargetType="{x:Type s:String}">
                           <xctk:WatermarkTextBox SelectAllOnGotFocus="True" Text="{Binding Value}"/>

Aug 30, 2012 at 1:33 PM

Thank you, that was very helpful!