问题标签 [hierarchicaldatatemplate]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
silverlight - Silverlight:选择时如何更改 TreeViewItem 文本颜色
我在 HierarchicalDataTemplate 中有 TextBlock。选择 TreeViewItem 时,我需要将前景色设置为红色。
silverlight - Silverlight:为什么在为 HierarchicalDataTemplate 设置代码时忽略 ItemsSource?
我在 App ResourceDictionary 中定义了 HierarchicalDataTemplate。如果我在 XAML 中设置 ItemsSource 属性,TreeView 的外观和行为都符合预期。但是,如果我在代码中将 DataTemplate 设置为此对象,从 XAML 中删除 ItemsSource 值并改为在代码中设置它(如以下示例),它将被忽略并且树节点不显示任何子节点。为什么会这样,我该如何解决?
wpf - WPF:TreeView 和嵌套模板
我正在尝试使用树视图显示一个类,但没有显示任何内容。我用 Snoop 检查了容器,我看到了 StackPanel,但它是空的,即使项目确实有标题和页面。没有绑定错误,我不知道为什么它不起作用。
然后在窗口本身:
c# - 分层数据结构 WPF TreeListView
我目前正在编写一个 WPF TreeListView。我想知道几件事。
分层数据结构如何工作,子级能否显示其他属性而不是与父级相同的属性?目前我正在尝试用列制作一个treelistview
客户/事项/时间
如果我添加一个客户并且它有同样的问题,那么父母会将它的小时数更改为总小时数到孩子们加起来的总小时数。
这是一个例子
我加
John / 书写纸 / 1 小时
John / 书写纸 / 2 小时
John / 书写纸 / 0.5 小时
我的树列表视图将显示
John / 书写纸 /3.5 小时 < 这是家长
-John / 书写纸 / 1 小时
-John / 书写纸 / 2 小时
-John / 书写纸 / .5 小时 < 这些是孩子
相反,我希望它显示
John / Writing Paper/ 3.5 小时
- 12:00 am - 1:00 pm / 写引言
- 2:00 pm - 4:00 pm / 写正文
- 3:00 pm - 3:30 pm / 写结论
我正在使用两个可观察的集合。一个是父母,一个是孩子。
我的问题基本上是。我可以更改分层数据结构以显示不同的属性吗?不同的信息。我不想重复显示相同的客户事务时间。相反,我想为孩子展示不同的属性。因为父母将显示信息属于谁。顺便说一句,我正在尝试为 XAML 和 C# 执行此操作
提前致谢!!
-凯文
wpf - 在 WPF TreeView 中更改数据的上下文菜单
有没有办法在 a 中指定根据项目绑定到的数据上的属性TreeView
使用HierarchicalDataTemplate
不同的值?ContextMenu
例如,如果为真则显示一个,ContextMenu
如果为真则显示另一个,等等。Item.IsFile
Item.IsFolder
wpf - 带有 ControlTemplate 的 HierarchicalDataTemplate 和 HeaderedItemsControl 无法显示嵌套数据
我可以使用这种模式,Menu
但是TreeView
当我尝试使用以下内容时一定会遗漏一些东西HeaderedItemsControl
:
在 XamlPadX 中,这显示:
我需要做些什么ControlTemplate
来让数据正确显示吗?还是我需要更详细的(或额外的)HierarchicalDataTemplate
?另外:我们如何显示foo/@b
数据?
wpf - 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 going to change from Person to Person, how can this parameter be set every time?
wpf - WPF 对象将自身作为 MultiBinding 路径发送
基本上我需要知道的是如何将源发送HierarchicalDataTemplate
到绑定中,这就是我所拥有的:
所以我的源是一个类型的对象myModel:Person
,我希望能够发送对象本身,MultiBinding
以便PersonConverter
可以使用它。
谢谢你的帮助。
wpf - WPF Treeview HierarchicalDataTemplate 拖放
我在 wpf 中有一个树视图,它是使用下面的 xaml 构建的。这是一个结构良好的数据源,我在拖放时遇到了很多麻烦。我尝试了几种方法,都无济于事。谁能告诉我做这种事情的标准程序是什么?
wpf - 如何在 TreeView 中混合数据绑定和静态级别?
我有一个Database对象的集合,每个对象都包含Schema对象和User对象的集合。我想将它们绑定到 TreeView,但在层次结构中添加额外的静态级别,以便生成的 TreeView 看起来或多或少像这样:
通过使用以下模板,我能够非常接近我想要的:
然后在代码中我这样设置绑定:
生成的 TreeView 看起来像我想要的那样,但无法选择特定的架构或用户。显然 WPF 将在数据库节点上的整个子树视为单个项目,并且它只选择整个事物。我需要能够选择特定的模式、用户或数据库。如何设置模板和绑定,使其按我需要的方式工作?