TreeListBox trigger GetIsSelected call?

Grids for WPF Forum

Posted 2 years ago by John Dunn
Version: 17.1.0651
Avatar

Is there a way to force the TreeListBox to call GetIsSelected for a particular item? The items contained don't have a property can can be used to trigger the call via IsSelectedPath. I can create a dummy property but I'd rather just make a call on the TreeListBox itself to force it to call GetIsSelected.

Comments (3)

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

Hi John,

Can you give more info on the use case here?  Right now the main selection syncs again (causing calls to GetIsSelected) when the IsRootItemVisible, ItemAdapter, or RootItem properties change. 


Actipro Software Support

Posted 2 years ago by John Dunn
Avatar

The children of the RootItem can be selected both via the TreeListBox directly but also through an entirely different mechanism. This other mechanism ( think a 2d drawing application ) has its own internal concept of selection that I wish to synchronize with the selection in the TreeListBox. The children objects do not have a property that represents their selection state - if they did I could use IsSelectedPath to make the TreeListBox aware of selection changes. The internal selection mechanism does have a callback that gets called whenever something is selected/deselected so from within that call I'd like to call something like TreeListBox.ItemSelectionHasChanged(object) which would then force the call to TreeListBoxItemAdapter.GetIsSelected. 

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

Hi John,

Actually you could probably just have the adapter.IsSelectedPath set to something like "IsSelected" and have your data item raise the PropertyChanged event for "IsSelected" when you need to notify the change.  As long as your GetIsSelected method is implemented, that all should work and is a way to notify our side.  You don't even need to actually have an IsSelected property on your data item.  Just notifying that a certain dummy property name changed and specifying that property name via IsSelectedPath should be enough to kick in our call to GetIsSelected.


Actipro Software Support

The latest build of this product (v2018.1 build 0675) was released 8 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.