Two EditableContentControls inside of TreeListBoxItem. No Way to Identify Which Was Clicked

Grids for WPF Forum

Posted 2 months ago by Dan Hutt
Version: 19.1.1
Avatar

Hi there! We have a TreeListBox that has items in it that are editable via a "slow/single tap" in the row. This works GREAT with EditableContentControl when there is only a single value (i.e only a name). However, in our other instance we have a name and a number field that need to be editable. From what I'm seeing, EditableContentControl and the [Get/Set]IsEditing don't allow us to know which EditableContentControl the user has clicked on so we can set that specific property to true.

Our viewmodels have an IsRenumbering and a IsRenaming property in this instance, instead of a single, bindable property. This also seems to make it impossible for us to set the IsEditingPath since that is a string.

Thanks for any help in figuring this use case out. Am I missing something?

FYI: My currently "working" (via lots of duct tape) solution is to cache the last clicked EditableContentControl through a behavior. When the IsEditing property is being set in the ItemAdapter we query the attached property on the behavior and then set IsEditing on the control (which sets it in the viewmodel). This property then has to react to IsRenaming/IsRenumbering property changed events and aggregate back up to the IsEditing property. I also have the IsEditingPath set to "IsEditing"... While this works, you can see how brittle it is. 

I'm really wondering if there is a better way to do this that I've missed.

[Modified 2 months ago]

Comments (1)

Posted 2 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Dan,

The design for TreeListBox editing unfortunately only accommodates a single IsEditing status and is pushed through the item adapter to the tree node behind the scenes.  There won't be an easy way to do what you're after with the current API.

That being said, I wonder if you could make another SecondaryEditableContentControl class that inherits EditableContentControl and add logic so that when it is clicked, it handles the left mouse button down and sets its own IsEditing property to true.  Use that for the secondary editable content.  Then use a regular EditableContentControl for the primary editable content so that F2 activates it.  That may work.


Actipro Software Support

The latest build of this product (v24.1.2) was released 5 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.