Select/highlight text when selecting the property

Posted 27 days ago by Avatar Antoine Picard

Hi !

I was wondering if it's possible to select the content of a property when I click on it ? I think something like this post ( ) but as it's pretty old (7 years) do you have any idea how it would be possible ?

I tried something with the OnItemSelecting event but I didn't find anything to "highlight" the value. I would like the same selection as the tab behavior.

Comments (5)

Posted 26 days ago by Actipro Software Support - Cleveland, OH, USA

Hi Antoine,

I'm not sure that's done easily because the property value editor can be anything.  In some cases it might be a TextBox, in others an Editors edit box, or something completely different.  It's up to the individual controls used in the property value editor template to determine how they react to mouse clicks.

You might be able to look at some PreviewMouseLeftButtonDown events or something like that on to try and catch a double-click before a child control ever gets them,  Then react based on the hierarchy of what was clicked appropriate.

Actipro Software Support
Posted 26 days ago by Antoine Picard

Hi !

So if I understand well, there's no easy way.

With the OnPreviewMouseLeftButtonDown event, I have nothing more than what I have with ItemSelecting event. Moreover, it will be triggered by any click, even if it's not on an property, what's better with this event ?

I don't care about any double click, I just need a normal click to trigger the selection of the whole text (even if it's a string, bool, path...)

When you say "react based on the hierarchy of what was clicked appropriate", what do you mean ? I don't really understand this.

Posted 25 days ago by Actipro Software Support - Cleveland, OH, USA

Correct, using the preview mouse down event isn't any better really than using the ItemSelecting event.  In fact it's tricker because it could fire for any visual in the UI hierarchy so that means you'd have to walk up the visual tree to even determine which property row contains the UI element that was clicked, if any.  

Actipro Software Support
Posted 22 days ago by Antoine Picard

Okay, so it's not really possible to do what I want ? Too tricky ?

Posted 22 days ago by Actipro Software Support - Cleveland, OH, USA

Hi Antoine,

You might be able to support click-to-select-all functionality with some ideas like what's in here (i.e. Donnelle's answer):

Note that our product will try and select all text and focus the textbox when double-clicking on the related name column.  That makes it easy to edit the entire property value without any other tricks.  It can only do that for properties that use TextBoxes in their value property editors, but works very well for those.

Actipro Software Support
Information The latest build of this product (2018.1 build 0673) was released 7 days ago, which was after the last post in this thread.

Add a Comment

Please log in to a validated account to post comments.