treeviewitem

Treeview Item Loses Selection When Focus Is Lost

心已入冬 提交于 2019-12-07 13:31:00
问题 I have noticed this on an application I am working on right now, so I created a simple test app to demonstrate. Below is my a window and the event handler for the treeview items. If you expand either the "One" or "Two" parent nodes, and click one of the children, the child that was selected does not show up as selected after the Focus() method is called on the text box. Instead, selection pops to the parent node. Does anyone have any idea how to overcome this, and have the selection remain

GtkTreeView's row right click

岁酱吖の 提交于 2019-12-07 05:45:56
问题 How do I do something when user right click in a treeview's row? 回答1: It's really easy, just listen to the "button-press-event" signal and use treeview.get_path_at_pos() to figure the selected row: def button_press_event(treeview, event): if event.button == 3: # right click model, path = treeview.get_path_at_pos(int(event.x), int(event.y)) # do something with the selected path treeview.connect('button-press-event' , button_press_event) 来源: https://stackoverflow.com/questions/4570859

WPF Double Click TreeviewItem Child Node

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-06 20:18:58
问题 I have a treeview Item as such in a treeview that will have a list bound to it: <TreeViewItem Name="tviOffline" Foreground="Red" FontWeight="Bold" Header="Offline"> <TreeViewItem.ItemTemplate> <DataTemplate DataType="{x:Type local:Buddy}"> <StackPanel> <TextBlock Text="{Binding Nick}" FontSize="10" Foreground="#8CFFD528" /> </StackPanel> </DataTemplate> </TreeViewItem.ItemTemplate> </TreeViewItem> I cannot figure out how to get each of its childs to have a double click event. any help is

TreeItem selection width in a TreeView

你说的曾经没有我的故事 提交于 2019-12-06 07:42:19
问题 I'm using JavaFX 8 and I'm currently doing some GUI developments. I have a little problem with my TreeView and I need your help. Do you know if it is possible, in a TreeView, to select just the label and not the whole width of the TreeCell ? I mean (Netbeans example) : Instead of : Thank you in advance. 回答1: Please try adding a Label inside TreeCell. for example: private static class YourItemCell extends TreeCell<YourItem> { Label label; public YourItemCell() { label = new Label(); }

How do you get the level of a treeviewitem in WPF C#?

前提是你 提交于 2019-12-05 21:45:43
How do you get the level of a treeviewitem in WPF C#? In windows forms there is a .Level member of the treeview class but there does not seem to be one for WPF C#. Aran Mulholland Build a view model. A View model gves you greater flexibility with the treeview than you can achieve without it. Do yourself a favour, dont walk the visual tree, If a parent node is not visible, it could be virtualised away and your level (or depth) figure will be wrong. build a view model that wraps your data and knows at what level it is at. Check out the answers posted here. answer link one (you would add another

GtkTreeView's row right click

若如初见. 提交于 2019-12-05 09:06:19
How do I do something when user right click in a treeview's row? Johan Dahlin It's really easy, just listen to the "button-press-event" signal and use treeview.get_path_at_pos() to figure the selected row: def button_press_event(treeview, event): if event.button == 3: # right click model, path = treeview.get_path_at_pos(int(event.x), int(event.y)) # do something with the selected path treeview.connect('button-press-event' , button_press_event) 来源: https://stackoverflow.com/questions/4570859/gtktreeviews-row-right-click

WPF Double Click TreeviewItem Child Node

我的梦境 提交于 2019-12-05 02:41:19
I have a treeview Item as such in a treeview that will have a list bound to it: <TreeViewItem Name="tviOffline" Foreground="Red" FontWeight="Bold" Header="Offline"> <TreeViewItem.ItemTemplate> <DataTemplate DataType="{x:Type local:Buddy}"> <StackPanel> <TextBlock Text="{Binding Nick}" FontSize="10" Foreground="#8CFFD528" /> </StackPanel> </DataTemplate> </TreeViewItem.ItemTemplate> </TreeViewItem> I cannot figure out how to get each of its childs to have a double click event. any help is appreciated. thanks much. <TreeView.ItemContainerStyle> <Style TargetType="{x:Type TreeViewItem}">

Context Menu for XAML Treeviewitem (Distinguished by different attributes)

我是研究僧i 提交于 2019-12-03 10:57:14
问题 In XAML, how do you define a context menu for treeviewitems that are distinguished by different attributes? 回答1: XAML <TreeView Name="SolutionTree" BorderThickness="0" SelectedItemChanged="SolutionTree_SelectedItemChanged" > <TreeView.Resources> <ContextMenu x:Key ="SolutionContext" StaysOpen="true"> <MenuItem Header="Add..." Click="AddFilesToFolder_Click"/> <MenuItem Header="Rename"/> </ContextMenu> <ContextMenu x:Key="FolderContext" StaysOpen="true"> <MenuItem Header="Add..." Click=

Context Menu for XAML Treeviewitem (Distinguished by different attributes)

牧云@^-^@ 提交于 2019-12-03 02:28:35
In XAML, how do you define a context menu for treeviewitems that are distinguished by different attributes? Mr. T. XAML <TreeView Name="SolutionTree" BorderThickness="0" SelectedItemChanged="SolutionTree_SelectedItemChanged" > <TreeView.Resources> <ContextMenu x:Key ="SolutionContext" StaysOpen="true"> <MenuItem Header="Add..." Click="AddFilesToFolder_Click"/> <MenuItem Header="Rename"/> </ContextMenu> <ContextMenu x:Key="FolderContext" StaysOpen="true"> <MenuItem Header="Add..." Click="AddFilesToFolder_Click"/> <MenuItem Header="Rename"/> <MenuItem Header="Remove"/> <Separator/> <MenuItem

Why is the TreeViewItem's MouseDoubleClick event being raised multiple times per double click?

可紊 提交于 2019-12-02 20:31:12
XAML <TreeView Name="GroupView" ItemsSource="{Binding Documents}"> <TreeView.ItemContainerStyle> <Style TargetType="{x:Type TreeViewItem}"> <EventSetter Event="MouseDoubleClick" Handler="OnTreeNodeDoubleClick"/> </Style> </TreeView.ItemContainerStyle> .... </TreeView> Code-Behind private void OnTreeNodeDoubleClick(object sender, MouseButtonEventArgs mouseEvtArgs) { Console.WriteLine("{3} MouseDoubleClick Clicks={0} ChangedButton={1} Source={2} Handled={4} ButtonState={5}", mouseEvtArgs.ClickCount, mouseEvtArgs.ChangedButton, mouseEvtArgs.OriginalSource, mouseEvtArgs.Timestamp, mouseEvtArgs