treeview

How to disable expanding/collapsing of tree items in WPF TreeView on double-click

浪子不回头ぞ 提交于 2021-02-19 08:09:06
问题 How can I disable tree items collapsing/expanding when I double-click on tree item? I still would like to do this by clicking on toggle button, but not when I double-click on item. This is XAML I have: <TreeView Grid.Column="0" Grid.Row="0" ItemsSource="{Binding Categories}" helpers:TreeViewHelper.SelectedItem="{Binding SelectedCategory, Mode=TwoWay}" > <TreeView.ItemContainerStyle> <Style TargetType="{x:Type TreeViewItem}"> <Setter Property="IsExpanded" Value="True"/> </Style> </TreeView

How to move popup window when scrolling a tkinter treeview?

て烟熏妆下的殇ゞ 提交于 2021-02-19 04:56:14
问题 I have a tkinter treeview with a vertical scrollbar. To make it (look like) editable, I create a popup Entry when the user double-clicks on a cell of the treeview. However, I can't make the popup to move when the treeview is scrolled. import tkinter as tk from tkinter import ttk class EntryPopup(ttk.Entry): def __init__(self, parent, itemId, col, **kw): super().__init__(parent, **kw) self.tv = parent self.iId = itemId self.column = col self['exportselection'] = False self.focus_force() self

WPF Step By Step 自定义模板

ぃ、小莉子 提交于 2021-02-19 03:51:49
本文大纲 1、控件模板及数据模板 2、ListBox深度定制模板。 3、TreeView高级模板使用实例。 控件模板及数据模板 控件模板 什么是控件模板,指定可以在控件的多个实例之间共享 Control 的可视结构和性能方面的方面。控件模板其实就是我们在可视方面的自定义模板,ControlTemplate 允许您指定控件的可视结构。 重写 ControlTemplate 重新生成该控件的可视结构。 模板化控件是 WPF 提供的许多功能之一样式设置和模板化模型。 该样式和模板化模型提供了许多情况下您不需要编写拥有控件这样的大的灵活性。 控件模板包含二方面的内容:VisualTree和Tigger。本篇介绍的内容,完全都是基于这二块的内容进行讨论和说明。 什么是ViewTree VisualTree就是对应WPF控件的可视元素的定义,下面来举例说明: 上面,我们通过了lable重写了button按钮的控件模板,我们还可以采用更复杂的控件来重写它: 运行后的效果效果就是上面的预览图,我们当然还可以构建更复杂的情况,WPF中基本上所有的控件,都可以定义控件模板。 上面的情况是我们针对一个按钮重写这样的控件模板,如果我们一个页面中有多个控件,并且这些控件的样式都是一样的,唯一的区别是控件的内容或文本不同而已,我们应该如何做呢?这个时候我们就需要把控件模板定义为资源,如下所示:

WPF Heirachical DataTemplate in TreeView

醉酒当歌 提交于 2021-02-16 15:18:30
问题 I am trying to get my head around Heirarchical DataTemplates and TreeViews in WPF and am having some trouble. I have created an app with only a TreeView on the form as below and defined HierarchicalDataTemplate's for both a Directory object and a File object I then Bind the TreeView to the Directories property (ObservableCollection) of my model. <Grid> <Grid.Resources> <HierarchicalDataTemplate DataType="{x:Type local:Directory}" ItemsSource ="{Binding Directories}"> <TextBlock Text="{Binding

How to keep an area a constant/relative size while user expands/collapses treeview?

左心房为你撑大大i 提交于 2021-02-11 15:01:38
问题 I have a window that will be a variable size , currently it is 300 x 400 as shown below. In the top part I have an expandable tree view In the bottom part I have a long horizontal panel with a button in it. I want the top area (treeview) to be about 95% of the height, with the button tool area a constant 50 high. I want these proportions to stay constant as the user expands and collapses the tree view (and as it expands below the button toolbar, I want the viewscroller to pop in with a

How to keep an area a constant/relative size while user expands/collapses treeview?

微笑、不失礼 提交于 2021-02-11 14:58:42
问题 I have a window that will be a variable size , currently it is 300 x 400 as shown below. In the top part I have an expandable tree view In the bottom part I have a long horizontal panel with a button in it. I want the top area (treeview) to be about 95% of the height, with the button tool area a constant 50 high. I want these proportions to stay constant as the user expands and collapses the tree view (and as it expands below the button toolbar, I want the viewscroller to pop in with a

get parent-note in treeview when the child-items are the same object

耗尽温柔 提交于 2021-02-11 14:21:43
问题 i have a TreeView with same in xaml createt TreeViewItems. And one note has a ObservableCollection as ItemSource. This works like a Charm. But now i want same Notes to every item of the list (for better organization). So i do this: This is my HierarchicalDataTemplate for the liste <HierarchicalDataTemplate DataType="{x:Type classes:Connection}" ItemsSource="{Binding Source={StaticResource ConnectionChilds}}" > <TextBlock Text="{Binding DisplayName}" /> </HierarchicalDataTemplate> And the

UWP Scale textblock inside treeview - text wrapping

心已入冬 提交于 2021-02-08 07:27:34
问题 Can please anyone help, I am working on a UWP app and I want TextBlock to wrap the text inside it according to window width. That Textblock is inside Grid which is inside TreeView. Now when I resize my app window it doesn't do anything. Original: Resized: I want it to look like this and don't have fixed width but to change dynamically with window: This is my XAML code: <TreeView Name="ItemsTreeView" SelectionMode="Multiple" ItemsSource="{x:Bind DataSource}" CanReorderItems="False" CanDrag=

UWP Scale textblock inside treeview - text wrapping

巧了我就是萌 提交于 2021-02-08 07:25:36
问题 Can please anyone help, I am working on a UWP app and I want TextBlock to wrap the text inside it according to window width. That Textblock is inside Grid which is inside TreeView. Now when I resize my app window it doesn't do anything. Original: Resized: I want it to look like this and don't have fixed width but to change dynamically with window: This is my XAML code: <TreeView Name="ItemsTreeView" SelectionMode="Multiple" ItemsSource="{x:Bind DataSource}" CanReorderItems="False" CanDrag=

Changing WPF TreeView SelectedItem in SelectedItemChanged event

早过忘川 提交于 2021-02-08 05:10:00
问题 I currently have a WPF Treeview with a structure of: --> Group 1 (Hierarchical Group) ---> Group 2 (Hierarchical Group) ---> Item 1 ---> Item 2 ---> Item 3 I currently have a SelectedItemChanged event handler hooked up to this treeview like so private void TreeViewControl_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e) { if (e.NewValue is Item) { Item item = e.NewValue as Item; if (Item != SelectedItem) { //keep SelectedItem in sync with Treeview.SelectedItem