hierarchicaldatatemplate

Linq query to treeview HierarchicalDataTemplate

偶尔善良 提交于 2019-12-24 21:17:15
问题 First, sorry for my bad english. I have an EF entity that looks like: class Item { public Guid Id { get; set; } public string Title{ get; set; } public Guid? ParentId { get; set; } public ICollection<Item> Items { get; set; } } Now i want to load the data from that entity on a treeview... the best I could get is the follow xaml: <TreeView Name="treeItems"> <TreeView.ItemTemplate> <HierarchicalDataTemplate DataType="{x:Type local:Item}" ItemsSource="{Binding Items}"> <TextBlock Text="{Binding

How do I dynamically make user controls in a HierarchicalDataTemplate editable/read-only?

て烟熏妆下的殇ゞ 提交于 2019-12-24 12:04:05
问题 Does anyone know how to change the IsReadOnly property of controls (TextBox, ComboBox, etc.) in a WPF HierarchicalDataTemplate dynamically? I want to be able to make the controls contained in the HierarchicalDataTemplate editable for some users and read-only for others. I have tried binding the IsReadOnly property on each control in the HierarchicalDataTemplate to a predetermined Boolean value in the page's ViewModel, but am unable to get the binding to work. Any help is greatly appreciated.

Hierarchical Data Structure WPF TreeListView

白昼怎懂夜的黑 提交于 2019-12-24 10:45:08
问题 I am currently writing a WPF TreeListView. I was wondering a couple of things. How does the Hierarchical Data Structure work and can the children display other properties instead of the same property as the parent? Currently I am trying to make a treelistview with the columns Client / Matter / Hours If i add a client and it has the same matter then the parent will change it's hours to the total hours to the total amount of hours added up by the children. Here's an example I add John / Writing

Can I have a Treeview without the tree structure?

扶醉桌前 提交于 2019-12-24 07:06:14
问题 Can someone tell me how I can template a treeview control so that it doesn't look like a tree? Basically, I want to remove the indents at various levels as well as the +/- that allow for expansion and collapse. The actual requirement is that I have a hierarchical data template that is bound to an object collection that is recursive in nature. And I want to display these objects on screen in a flat manner. The best solution would be to get the hierarchical data template to work with an

HierarchicalDataTemplate for TreeView

﹥>﹥吖頭↗ 提交于 2019-12-24 05:28:13
问题 Ok, I don't get it at the moment. I've searched google and Stackoverflow for a while and saw lot's of examples how to use the HierarchicalDataTemplate I have a class called Class which looks like: [Table(Name = "Class")] public class Class { [Column(IsDbGenerated = true, IsPrimaryKey = true)] public int Id { get; private set; } [Column] public string ClassName { get; set; } } And I have a class called Pupil which looks like: [Table(Name = "Pupil")] public class Pupil { [Column(IsPrimaryKey =

How can I have multiple types of children in a single Silverlight TreeView node?

邮差的信 提交于 2019-12-22 06:47:32
问题 Short Vesion: I have to display a hierarchy ( TreeView ) of items of different types, and am not sure how to do this cleanly in Silverlight. In WPF, it's straightforward to define templates ( HierarchicalDataTemplate ) based on types, but this feature isn't available in Silverlight. It seems in Silverlight you have to apply the same template to all children of a specific node, so you end up with once single monster template that handles every possible type of node, applied to every single

Why can't a DataTemplate bind to an interface when that DataTemplate was explicitly returned from a DataTemplateSelector?

牧云@^-^@ 提交于 2019-12-22 04:57:23
问题 I've created a DataTemplateSelector which is initialized with a collection of known interfaces. If an item passed into the selector implements one of those interfaces, the associated data template is returned. First, here's the ICategory interface in question... public interface ICategory { ICategory ParentCategory { get; set; } string Name { get; set; } ICategoryCollection Subcategories { get; } } Here's the DataTemplateSelector which matches based on a base class or interface rather than

Recursive HierarchicalDataTemplate (WPF)

杀马特。学长 韩版系。学妹 提交于 2019-12-21 04:57:15
问题 I'm not sure how to approach this: I want a TreeView that will display some simple data from a hierarchical data structure. As a basic example (In XML, cause it's easy to type): <Node text="Root"> <Node text="Item 1"> <Node text="Item 1.1" /> </Node> <Node text="Item 2"/> </Node> The catch is that this could theoretically nest infinitely deep, so you can't statically define x number of levels and be done with it. Is there a way to define a HierarchicalDataTemplate that can account for this

Command Binding in hierarchical datatemplate

我的未来我决定 提交于 2019-12-20 14:10:44
问题 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="{Binding Path=ChildrenItems}"> <MenuItem Header="{Binding Name}" Command="{Binding RunOperationCommand}" /> </HierarchicalDataTemplate> </MenuItem.ItemTemplate> </MenuItem> menu looks like as it should, but Command for each menu item is not fired! Even

Command Binding in hierarchical datatemplate

馋奶兔 提交于 2019-12-20 14:09:17
问题 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="{Binding Path=ChildrenItems}"> <MenuItem Header="{Binding Name}" Command="{Binding RunOperationCommand}" /> </HierarchicalDataTemplate> </MenuItem.ItemTemplate> </MenuItem> menu looks like as it should, but Command for each menu item is not fired! Even