问题标签 [treeviewitem]
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.
wpf - ListView Inside Child TreeViewItem?
Hey guys, I have a WPF TreeView that has three nodes, I would like the last child (the third node) to contain a ListView populated with my bound data. The issue that I'm running into is that if I put a ListView in the ItemTemplate of my HierarchicalDataTemplate I get a ListView for each child rather than a single ListView with content. This is expected behavior per the documentation, but I'm looking for a work around (possibly modify the ItemContainerStyle), unfortunately I have virtually no experience with the TreeViewItem's control template, or for that matter much experience with TreeViews in general.
I've looked at the posibility of using a TreeListView but it doesn't fit my use case, nor does binding a separate control and displaying data that way.
Has anyone either already gone through the headache of sandwiching a ListView into a TreeViewItem, or can someone suggest how to modify the ControlTemplate to accomplish this?
Thank you, Aj
.net - 在运行时向 WPF TreeViewItem 添加图标
XAML 中有许多示例演示了这一点,例如:
但我需要在运行时代码中执行此操作 - TreeView 的目的是显示计算机上的文件和文件夹。
所以我不确定如何在代码中使用 Header:
任何人都可以演示这个概念吗?
编辑:我想我明白了,我应该使用带有两个单独控件的水平 StackPanel - TextBlock 和 Image。这是正确的方法吗?
binding - 来自 Converter 的 HierarchicalDataTemplate 参考 TreeViewItem
我需要根据父树视图项的高度调整树视图项的边距。我试图在分层数据模板中的堆栈面板中添加一个转换器,但它没有给我任何方法来访问转换器 convertTo 方法中的树视图项。
有什么方法可以将 treeView 实例作为 converterParameter 传递给 convertTo 方法,以便我可以从转换器方法中按名称找到 treeviewitems?
谢谢
wpf - 如何使用基于 .Net 类属性的值自动更新 WPF TreeViewItems?
早上好。我有一个从 InotifyPropertyChange 派生的数据的类。数据来自后台线程,该线程在特定位置搜索具有特定扩展名的文件。类的公共属性通过在单独的线程中更新数据来响应 OnPropertyChange 事件。此外,还有基于 HierarhicalDataTemplates 的 XAML TreeView 中的描述。模板中的每个 TextBlock 都提供了 ItemsSource = "{Binding FoundFilePaths, Mode = OneWay, NotifyOnTargetUpdated = True}"。
问:为什么从 INotifyPropertyChange 派生的类中的数据不影响树项的显示。我是否理解:该界面会使 INotifyPropertyChange 自动重绘 TreeViewItems 还是我需要手动执行此操作?目前 TreeViewItems 未更新,PropertyChamged 始终为空。感觉 OnPropertyChanged 事件没有订阅者。
wpf - WPF TreeViewItem 没有从后面的代码扩展
我为 TreeViewItem 定义了以下样式:
当模型的 IsExpanded 属性在后面的代码中设置为 true 时,我无法让 TreeViewItem 展开。但是,当 TreeViewItem 从用户界面展开时,模型 IsExpanded 属性会发生变化。我错过了什么?
谢谢。
click - GtkTreeView的行右键
当用户右键单击树视图的行时,我该怎么做?
wpf - WPF-有没有办法阻止 TreeViewItems 在其父 TreeViewItem 被选中时被选中和激活?
我有一个控制模板,TreeViewItems
而不是显示正常FocusVisualStyle
我有这样的MultiTrigger
设置:
但是,这也会导致在选择父项FontWeight
时更改为粗体。TreeViewItem's
有什么办法可以阻止这种情况发生吗?
c# - WPF:突出显示显示上下文菜单的 TreeView 项目
我正在使用 TreeView 进行过滤器选择。
TreeView 上的不同类别启动不同的过滤器,运行可能需要 3 秒。
每个类别都有自己的上下文菜单,您可以在其中重命名、删除等。
我想让用户看到他右键单击的项目。途中将选择右键单击事件中的项目。但这会导致菜单加载缓慢,因为它运行相关的过滤器。
那么,如何在上下文菜单显示事件中突出显示给定项目?
谢谢
c# - Treeview 删除属性问题
我在树视图中添加了一个 SampleNode。
如果我从 SampleNode 中删除任何节点,
像,
它在树视图中被删除,但在 SampleNode 中没有。为什么会发生这种情况?
解决办法是什么?
wpf - 数据绑定时自定义 WPF TreeViewItem 样式行为不正确
我已经根据我的需要调整了 TreeViewItemStyle,当我像这样对 TreeViewItems 进行硬编码时,它的效果很好:
(我不能发布图片,所以我必须链接到它们)
第一个图像是完美的,但第二个是在我尝试对 TreeView 进行数据绑定时创建的。就分层数据而言,下面的代码可以正常工作,但它的显示方式与我想要的不同。
你可以看到它产生的令人讨厌的效果。
出了什么问题?
我的风格如下(为了便于阅读,删除了一些画笔和动画):