Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
Status: New
XamDataTree with more MVVM focus

Currently, there are many issues we're facing with the XamDataTree that's leading to tedious work being done on our end.

For example:

The XamDataTree does not have a usable ReadOnly state. You can set the IsEnabled property on the Tree, but that disables scrolling, expanding/collapsing nodes completely.
You can apply a read only style to the CheckBoxStyle in the CheckBoxSettingsOverride; however, this is not a dependency property, so you can't apply a template depending on the binding of a property in our view model.

This leads us to have two entirely different DataTemplates in our View that need to be switched between depending on the property in the ViewModel, duplicating a massive amount of XAML.

Further, even if you set the CheckBoxStyle to a custom Style with the checkbox disabled, this doesn't prevent the user from pressing the space bar on a Node and changing the CheckBoxes' state. This is only preventable when you set the CheckBoxVisibility to Collapsed, but then the user will not be able to see the Checked/Unchecked/Tristate state of anything in the tree.

The XamDataTree also doesn't expose very useful events and properties. In our implementation, we're building up nested ObservableCollections of our TreeModels, and then running through them to initialize the Source of CollectionViews. The XamDataTree and its nodes are bound to these CollectionViews. This is because we plan on implementing filtering and searching later. However, if you share the same TreeModel around the tree, the UI doesn't update appropriately until you've actually brought that XamDataTreeNode into view; if it's collapsed under one parent and visible in another, checking the visible node doesn't update the other despite the data on the models updating fine.

This leads us to having to load the XamDataTree fully expanded just to bring all the data into memory to keep the visual consistency across the shared Models. But now we've got massive performance issues due to how the XamDataTree handles scrolling internally (see attached picture). And even if we tried to load it expanded initially and then trigger when it was done loading to collapse to a more manageable state, the Loaded event on the XamDataTree fires when that control is Loaded (obviously), but the visual nodes are initialized somewhere inside the NodesPanel that the control doesn't expose. None of the events on the XamDataTree actually correspond to the Tree being visually done.

  • Adding some other comments here:

    Changing the selection mode to multiple with visible checkboxes doesn't ever give you the ability to actually check multiple boxes at once. Selecting multiple nodes populates the SelectedDataItems, but pressing space or checking a box only affects the last clicked node.

    When filtering the bound CollectionViews, the XamDataTree checkboxes behave according to the filtered UI collections. For example, if a parent node has three children normally checking only one child will make the parent tristate. If you apply a filter to the bound CollectionView such that only one child is visible, checking that child will make the parent fully checked. Clearing the filter will then visually look like the parent is fully checked while only one of its children is checked. Intercepting the OnNodeCheckedChanged event, the e.Node arg knows (at some level) that the e.Node.ChildNodesManager.DataManager.ICollectionViewData.SourceCollection.Count is 3 and the e.Node.ChildNodesManager.Nodes.Count is 1, so it should be able to detect this discrepancy.

  • Thank you for the great feedback. I will discuss this with the team. I definitely want to make this easier to use. Would you mind emailing my your XAML at blagunas@infragistics.com