Problem with TreeViewEx.ItemTemplate

Nov 30, 2012 at 11:14 AM
Is there a way to get the TreeViewEx.ItemTemplate working?
            <tvx:HierarchicalDataTemplateEx ItemsSource="{Binding Path=Children}">
                <StackPanel Orientation="Horizontal">
                    <ContentControl Width="12"
                                    Foreground="{Binding Path=Color}"
                                    Template="{Binding Path=ResourceKey, Converter={StaticResource ControlTemplate}}" />
                    <TextBlock Text="{Binding Path=(gs:ITreeViewDisplayable.DisplayName)}" />
The "Children" do not have a common base datatype.
Dec 3, 2012 at 3:02 PM

Surely, but I probably have to implement it. ;-) I try to look at it at the weekend.


Regards, Torsten

Dec 12, 2012 at 6:31 PM

Ok, it took a little bit longer, but it should work now. I've changed the simple sample, in order to demonstrate.

Dec 17, 2012 at 11:11 AM

Thank you.

Now i have some difficulties with a load on demand scenario. My static dummy tree view object gets added multiple times in the TreeViewItemEx hashtable which throws an exception.

Could you add a "load on demand" example project to the solution?

Dec 19, 2012 at 7:18 PM

To clarify the problem: The error probably occures not because the loading on demand, it happens because you put the same object into the datacontext. Is that correct?

What do you mean with 'LoadOnDemand'? Do we talk about virtualization ( Data or UI? There is an UI-Virtuallization example in the source control.

Jan 2, 2013 at 1:38 PM

Hi, sorry for the late response.

The treeview has to represent the same object at different nodes. I think that the treeviewex class uses a hashtable where these objects are used as keys. That is where the exception occurs.

By 'LoadOnDemand' I mean a sort of data virtualization. Only if you expand a node in the tree view for the first time, the program loads the children from a datasource (and creates the viewmodels for the treeviewexitems) (



Feb 8, 2013 at 1:43 PM
This problem should be fixed with changeset 70679.