Trying to use a treeview with checkboxes in a dockpane

1380
2
04-30-2021 04:59 AM
MarioLandry
New Contributor II

Dear community,

I’m currently initiating myself to the development of ArcGIS Pro version 2.7, the WPF and the MVVM approach.  I’ve been developing with ArcObjects and VB.NET for the past 14 years.

Right now, I’m simply trying to replicate the code from a windows application where we see a treeview with checkboxes.  The code for that project can be found here: https://www.codeproject.com/Articles/28306/Working-with-Checkboxes-in-the-WPF-TreeView

The end result is an application that looks like this:

MarioLandry_0-1619783182941.png

And for example, if the user unchecks the Blades checkbox, all the childs (Dagger, Machete and Sword) are then unchecked.

I then tried to do the same thing using ArcGIS Pro SDK by creating a dockpane that does the same thing.  I had to adapt the code so that I was using PropertyChangedBase instead of INotifyPropertyChanged and also adjust the WPF because in a dockpane we are using a usercontrol instead of a window.  In the end, I’m able to compile the code, but once I run it, the dockpane is displayed, but I don’t see the treeview in itself.  I did debug it and I can see that it does not behave the same way under the dock pane than under windows.

So the question is:  Is it possible to use that type of treeview inside a dockpane?  If so, is there an example of it? It not, is there an alternative to being able to display hierarchical data?

Thanks in advance!

0 Kudos
2 Replies
GKmieliauskas
Esri Regular Contributor

Hi,

Yes, It is possible to use treeview inside a dockpane. We use it in different projects but without checkboxes. But no matter with or without checkboxes. Something wrong is with your binding or templating. Share your xaml content if you need help.

Sample here:

https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Content/ContentFileExplorer 

 

0 Kudos
MarioLandry
New Contributor II

Hello,

I confirm that I can use a regular treeview without any problem..  But a treeview with checkboxes is a different beast.

Especially if I click on a parent, I want all the child of that parent to follow the same pattern.

I've joined the code in a zip file.  It is basically the same as the one in the project https://www.codeproject.com/Articles/28306/Working-with-Checkboxes-in-the-WPF-TreeView

 

0 Kudos