treeviewitem

WPF TreeViewItem Background

佐手、 提交于 2019-11-30 20:50:58
问题 How can I change the Background of a selected TreeViewItem when the TreeView (or the Application) looses Focus. A selected item by default has in this situation a light grey background. EDIT: A try after first answer: But element with TargetName="Bd" will not be found. <TreeView> <TreeView.Resources> <Style x:Key="{x:Type TreeViewItem}" TargetType="{x:Type TreeViewItem}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type TreeViewItem}"> <ControlTemplate.Triggers

Apply style to all TreeViewItem

我们两清 提交于 2019-11-30 14:09:12
Hi The problem am having is that I have multiple TreeView control and each TreeView has its own TreeViewItem styles, setting it TreeView ItemContainerStyle="{StaticResource Style1}" will only set the root element NOT all the child elements, How to apply a style to all the child elements in a TreeView Bubblewrap There are several ways to accomplish this: You could make your style the default for all TreeViewItems: <Style TargetType="{x:Type TreeViewItem}"> ... </Style> The difference is that you do not set the x:Key attribute, but you do set the TargetType attribute. You do not need to set the

Invoke Command when TreeViewItem is Expanded

断了今生、忘了曾经 提交于 2019-11-29 07:20:07
Sounds simple enough? I have a TreeView, and I want something to happen when one of the nodes is expanded. I'm using MVVM, so that 'something' is a command in the ViewModel. Well, I'm finding that it's not so simple after all. I've looked around and tried a few things. For example, using MVVM Light's EventToCommand: <i:Interaction.Triggers> <i:EventTrigger EventName="TreeViewItem.Expanded"> <cmd:EventToCommand Command="{Binding Path=FolderNodeToggledCommand}" /> </i:EventTrigger> </i:Interaction.Triggers> This code (based on this and this ) doesn't work (nothing fires; the command is bound in

WPF treeview item background over entire row

放肆的年华 提交于 2019-11-28 12:27:59
i am writing one app and i need to set background under entire row by items. I found some inspiration in here but i cannot get idea how to get Border background value in template (the problem is a bit more complicated:) My problem is that in the treeview are 2 types of "data" (files and folders). User can modify the background under files and folders. Right now i have the background on textblock, but it seems horrible and i want to have the background over entire row (i think it will looks much better). Now it seems so: but what i need is: If i change the value of the border background, i

Binding SelectedItem in a HierarchicalDataTemplate-applied WPF TreeView

不羁的心 提交于 2019-11-28 06:58:56
I have a data-bound TreeView and I want to bind SelectedItem . This attached behavior works perfectly without HierarchicalDataTemplate but with it the attached behavior only works one way (UI to data) not the other because now e.NewValue is MyViewModel not TreeViewItem . This is a code snippet from the attached behavior: private static void OnSelectedItemChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) { var item = e.NewValue as TreeViewItem; if (item != null) { item.SetValue(TreeViewItem.IsSelectedProperty, true); } } This is my TreeView definition: <Window xmlns

Change expand and collapse image TreeView JavaFX 2.2

不羁的心 提交于 2019-11-27 08:03:26
问题 Is it possible to change the Expand and Collapse Images of a JavaFX 2.2 TreeVIew? Change this image, To an image like this (with +/-), 回答1: Sure, this is possible with a little bit of css. The CSS looks like this: .tree-cell .tree-disclosure-node .arrow { -fx-shape: null; -fx-background-color: null; -fx-background-image: url("plus-arrow.png"); } .tree-cell:expanded .tree-disclosure-node .arrow { -fx-shape: null; -fx-background-color: null; -fx-background-image: url("minus-arrow.png"); } lg

Highlight whole TreeViewItem line in WPF

巧了我就是萌 提交于 2019-11-27 06:03:56
If I set TreeViewItem Background it highlights the header only. How can I highlight the whole line? I have found a post almost solving a problem http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/b04f73e2-0b10-4d97-a6da-64df2e30c21d/ But there are some problems: 1. It does not highlight the whole line 2. The tree has XP style on Vista. I whould like it to looks the same way on Vista as it was, but if user changed the theme to XP - it should be XP way. 3. So many XAML... Any ideas, what I should look for? bendewey Here we go, third times a charm. If you want something that look like this.

Highlight whole TreeViewItem line in WPF

不羁岁月 提交于 2019-11-26 17:34:35
问题 If I set TreeViewItem Background it highlights the header only. How can I highlight the whole line? I have found a post almost solving a problem http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/b04f73e2-0b10-4d97-a6da-64df2e30c21d/ But there are some problems: 1. It does not highlight the whole line 2. The tree has XP style on Vista. I whould like it to looks the same way on Vista as it was, but if user changed the theme to XP - it should be XP way. 3. So many XAML... Any ideas, what