hierarchicaldatatemplate

Silverlight: Why is ItemsSource ignored when set in code for a HierarchicalDataTemplate?

I've defined a HierarchicalDataTemplate in the App ResourceDictionary. If I set the ItemsSource property in XAML, the TreeView looks and behaves as expected. However, if I set the DataTemplate to this object in code, remove the ItemsSource value from XAML and instead set it in code (like the following example), it gets ignored and the ...

WPF: TreeView and nested templates

I'm trying to display a class using a treeview but nothing is displayed. I've inspected the container with Snoop and I see the StackPanel, but it's empty, even the the project does have a title and pages. There are no binding errors and I have no idea why it's not working. public class Project : INotifyPropertyChanged { public s...

HierarchicalDataTemplate and HeaderedItemsControl with ControlTemplate fails to show nested data...

I can get this pattern to work with Menu and TreeView but I must be missing something when I make an attempt with HeaderedItemsControl: <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" > <Page.Resources> ...

WPF Binding to a method with parameter inside HierarchicalDataTemplate

Is there any way to bind a value to a textblock that is obtained from a method. For example, I pass my Person object into the HierarchicalDataTemplate, from there I can access its Weight property. Now lets say I want to get the weight in mars, I would call the InMars method that takes a parameter of int EarthWeight . Now earthweight is g...

WPF Treeview HierarchicalDataTemplate Drag and drop

I have a treeview in wpf that is built using the xaml below. It is a well structured data source, and I am having a lot of trouble dragging and dropping. I have tried several methods, all to no avail. Can anyone tell me what the standard procedure is for doing this type of thing? <TreeView x:Name="_treeView" ItemsSource="{Binding}" Gr...

How to mix databound and static levels in a TreeView?

I have a collection of Database objects, each containing collections of Schema objects and User objects. I want to bind them to a TreeView, but adding additional static levels in the hierarchy, so that the resulting TreeView looks more or less like this: <TreeView> <TreeViewItem Header="All the databases:"> <TreeViewItem Header="Db1"...

WPF TreeView HierarchicalDataTemplate - binding to object with multiple child collections

I am trying to get a treeview to bind my collection so that all groups show nested groups and each group will show entry. How can I use the HierarchicalDataTemplate so that treeview will process both SubGroups and Entries collection? Groups show subgroups and entries Example: Group1 --Entry --Entry Group2 --Group4 ----Group1 ------Ent...

Command Binding in hierarchical datatemplate

Hello! I have Menu in my app. I'm visualizing it using hierarchical data template: <MenuItem Header="Main menu" ItemsSource="{Binding ApplicationMenu}" > <MenuItem.ItemTemplate> <HierarchicalDataTemplate DataType="{x:Type tm:RMenuItem}" ItemsSource="{Bind...

HierarchicalDataTemplate when ItemsSource is not a collection

I am trying to define a HierarchicalDataTemplate. The ItemsSource I want to bind to will only ever have one item in it so I don't want it to be a collection, just a single item. How do I do this as it will only work if the path of ItemsSource points to a collection? ...

Bind a Wpf HierarchicalDataTemplate ItemsSource to a CollectionViewSource in a dictionary?

I'm trying to display a Wpf Treeview with items sorted by a CollectionViewSource. Currently, everything is working except sorting using this code in my resource dictionary: <HierarchicalDataTemplate DataType="{x:Type books:Container}" ItemsSource="{Binding Path=Items}"> <nav:ContainerControl /> </HierarchicalDataTemplate> What wo...

Error in XAML: Type reference cannot find public type

In my WPF application, I have a TreeView control defined in my XAML. I've added a TreeView.Resources section that looks like this: <TreeView.Resources> <HierarchicalDataTemplate DataType="{x:Type local:FileGroup}" ItemsSource="{Binding protXMLFiles}"> <TextBlock Text="{Binding Path=groupName}"/> </HierarchicalDataTemplat...

Grouping child objects in WPF TreeView

I am trying to get my tree view to group a collection of similar items by what they are. To keep things generic, my object hierarchy could look like this: Objects Object Group #1 Item #1 (Type 'A') Item #2 (Type 'A') Item #3 (Type 'B') Item #4 (Type 'B') Right now my TreeView shows these objects exactly like the object ...

WPF, Treeview and kinda special herarchical Data Template

Hello I have been searching the internet for two days and wasn't able to find any solution to my problem. Here it is. I have a data structure in wich you can find "Curves" objects and "CurveTypes" objects. A CurveType contains a collection of other curvetypes (category/subcategories). A CurveType also contains a collection of Curves ...

Hierarchical templating multiple object types in silverlight

Is it possible and if so what is the best way to implement the following hierarchical structure in a silverlight (4) TreeView control? (where Item and Group are classes which can exist in the tree). Group | |-Item | |-Group | | | |-Item | | | |-Item | |-Item The structure could of course be arbitrarily more complex than this, if need...

Recursive WPF data presentation without TreeView

I have a particular unknown-depth model hierarchy which I want to present in a UI panel in a simplified form (no user interaction, no expand/collapse, just display parents and indent subtrees of children). I have the following working fine as a TreeView, but it's heavier than what I want. Similar to how you can replace ListBox with Ite...

WPF: HierarchicalDataTemplate ItemsPanel

I have a TreeView which uses a custom ItemsPanel to show the first level of items in a StackPanel, but I need to show subitems in a StackPanel too. The problem is, the second level of items are shown in a WrapPanel, and as HierarchicalDataTemplate doesn't have an itemsPanel property I'm not sure how to do this. This is my xaml: <TreeVie...

HierarchicalDataTemplate Distinct leaves

I have a set of data that is structured like this: ItemA.GroupA ItemB.GroupA ItemC.GroupB ItemD.GroupC I need to present the data in a WPF Tree View like this: GroupA --- ItemA --- ItemB GroupB --- ItemC GroupC --- ItemD What XAML can I use to group the leaves by distinct value? For instance, there could be multple items ...

WPF - DataTemplate to show only one hierarchical level in recursive data

Hi all, I am using a tree to display my data: persons grouped by their teams. In my model a team can contain another team, so the recursion. I want do display details about the selected node of the tree using a contentpresenter. If the selection is a person, everything is fine: I can show the person name or datails without problem using...

Can't use attached property on combobox inside hierarchical datatemplate WPF

I'm hoping to use an attached property to assign a command to the selection changed event of a combobox that is embedded inside a treeview. I'm attempting to set the attached property inside the hierchical data template for the tree but the command is not set and does not fire when the item in the combobox is changed. I've found that ...

Having problem with treeview and Multilist Hierarchical data

I have the following 2 classes: public class DeviceGroup { public String Name { get; set; } public ObservableCollection<DeviceGroup> DeviceGroups { get; set; } public ObservableCollection<Device> Devices { get; set; } public DeviceGroup() { Name = String.Empty; Device...