Wrong hover effect on the child elements of a WPF TreeView
I would like to ask you an issue that I cannot solve. I have templated a WPF TreeView as follows:
<Style x:Key="TreeViewItemStyle" TargetType="{x:Type TreeViewItem}">
<Setter Property="Focusable"
Value="True" />
<Setter Property="IsExpanded"
Value="True" />
<Setter Property="Background"
Value="Transparent" />
<Setter Property="HorizontalContentAlignment"
Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
<Setter Property="VerticalContentAlignment"
Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
<Setter Property="HorizontalAlignment"
Value="Stretch" />
<Setter Property="Width"
Value="{Binding Path=ActualWidth, RelativeSource={RelativeSource AncestorType={x:Type TreeView}}}" />
<Setter Property="Foreground"
Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TreeViewItem}">
<Grid Name="PART_grid">
<Grid.ColumnDefinitions>
<ColumnDefinition MinWidth="19" Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<ToggleButton x:Name="Expander"
ClickMode="Press"
IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource TemplatedParent}}"
Style="{StaticResource ExpandCollapseToggleStyle}"/>
<Border x:Name="Bd"
Grid.Column="1"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
Padding="{TemplateBinding Padding}"
SnapsToDevicePixels="true">
<ContentPresenter x:Name="PART_Header"
ContentSource="Header"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</Border>
<ItemsPresenter x:Name="ItemsHost" Grid.Row="1" Grid.Column="1" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsExpanded" Value="false">
<Setter Property="Visibility" TargetName="ItemsHost" Value="Collapsed"/>
</Trigger>
<Trigger Property="HasItems" Value="false">
<Setter Property="Visibility" TargetName="Expander" Value="Hidden"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Cursor" Value="Hand" />
<Setter TargetName="PART_grid"
Property="Background"
Value="#e6f2fa" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
The problem is that the hover effect is really terrible. In fact, if the user goes on the TreeviewItem the effect should affect only the relative children and not the whole wrapper.
How can I solve this problem and make the hover effect fall only on the single element, parent or child?
Thank you so much and have a good day everyone
c# .net wpf user-interface mvvm
add a comment |
I would like to ask you an issue that I cannot solve. I have templated a WPF TreeView as follows:
<Style x:Key="TreeViewItemStyle" TargetType="{x:Type TreeViewItem}">
<Setter Property="Focusable"
Value="True" />
<Setter Property="IsExpanded"
Value="True" />
<Setter Property="Background"
Value="Transparent" />
<Setter Property="HorizontalContentAlignment"
Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
<Setter Property="VerticalContentAlignment"
Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
<Setter Property="HorizontalAlignment"
Value="Stretch" />
<Setter Property="Width"
Value="{Binding Path=ActualWidth, RelativeSource={RelativeSource AncestorType={x:Type TreeView}}}" />
<Setter Property="Foreground"
Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TreeViewItem}">
<Grid Name="PART_grid">
<Grid.ColumnDefinitions>
<ColumnDefinition MinWidth="19" Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<ToggleButton x:Name="Expander"
ClickMode="Press"
IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource TemplatedParent}}"
Style="{StaticResource ExpandCollapseToggleStyle}"/>
<Border x:Name="Bd"
Grid.Column="1"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
Padding="{TemplateBinding Padding}"
SnapsToDevicePixels="true">
<ContentPresenter x:Name="PART_Header"
ContentSource="Header"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</Border>
<ItemsPresenter x:Name="ItemsHost" Grid.Row="1" Grid.Column="1" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsExpanded" Value="false">
<Setter Property="Visibility" TargetName="ItemsHost" Value="Collapsed"/>
</Trigger>
<Trigger Property="HasItems" Value="false">
<Setter Property="Visibility" TargetName="Expander" Value="Hidden"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Cursor" Value="Hand" />
<Setter TargetName="PART_grid"
Property="Background"
Value="#e6f2fa" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
The problem is that the hover effect is really terrible. In fact, if the user goes on the TreeviewItem the effect should affect only the relative children and not the whole wrapper.
How can I solve this problem and make the hover effect fall only on the single element, parent or child?
Thank you so much and have a good day everyone
c# .net wpf user-interface mvvm
I think the problem is that the IsMouseOver trigger is affecting TargetName="PART_grid", and every TreeViewItem has a grid with the same name.
– Robin Bennett
Nov 23 '18 at 15:21
add a comment |
I would like to ask you an issue that I cannot solve. I have templated a WPF TreeView as follows:
<Style x:Key="TreeViewItemStyle" TargetType="{x:Type TreeViewItem}">
<Setter Property="Focusable"
Value="True" />
<Setter Property="IsExpanded"
Value="True" />
<Setter Property="Background"
Value="Transparent" />
<Setter Property="HorizontalContentAlignment"
Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
<Setter Property="VerticalContentAlignment"
Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
<Setter Property="HorizontalAlignment"
Value="Stretch" />
<Setter Property="Width"
Value="{Binding Path=ActualWidth, RelativeSource={RelativeSource AncestorType={x:Type TreeView}}}" />
<Setter Property="Foreground"
Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TreeViewItem}">
<Grid Name="PART_grid">
<Grid.ColumnDefinitions>
<ColumnDefinition MinWidth="19" Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<ToggleButton x:Name="Expander"
ClickMode="Press"
IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource TemplatedParent}}"
Style="{StaticResource ExpandCollapseToggleStyle}"/>
<Border x:Name="Bd"
Grid.Column="1"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
Padding="{TemplateBinding Padding}"
SnapsToDevicePixels="true">
<ContentPresenter x:Name="PART_Header"
ContentSource="Header"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</Border>
<ItemsPresenter x:Name="ItemsHost" Grid.Row="1" Grid.Column="1" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsExpanded" Value="false">
<Setter Property="Visibility" TargetName="ItemsHost" Value="Collapsed"/>
</Trigger>
<Trigger Property="HasItems" Value="false">
<Setter Property="Visibility" TargetName="Expander" Value="Hidden"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Cursor" Value="Hand" />
<Setter TargetName="PART_grid"
Property="Background"
Value="#e6f2fa" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
The problem is that the hover effect is really terrible. In fact, if the user goes on the TreeviewItem the effect should affect only the relative children and not the whole wrapper.
How can I solve this problem and make the hover effect fall only on the single element, parent or child?
Thank you so much and have a good day everyone
c# .net wpf user-interface mvvm
I would like to ask you an issue that I cannot solve. I have templated a WPF TreeView as follows:
<Style x:Key="TreeViewItemStyle" TargetType="{x:Type TreeViewItem}">
<Setter Property="Focusable"
Value="True" />
<Setter Property="IsExpanded"
Value="True" />
<Setter Property="Background"
Value="Transparent" />
<Setter Property="HorizontalContentAlignment"
Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
<Setter Property="VerticalContentAlignment"
Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
<Setter Property="HorizontalAlignment"
Value="Stretch" />
<Setter Property="Width"
Value="{Binding Path=ActualWidth, RelativeSource={RelativeSource AncestorType={x:Type TreeView}}}" />
<Setter Property="Foreground"
Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TreeViewItem}">
<Grid Name="PART_grid">
<Grid.ColumnDefinitions>
<ColumnDefinition MinWidth="19" Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<ToggleButton x:Name="Expander"
ClickMode="Press"
IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource TemplatedParent}}"
Style="{StaticResource ExpandCollapseToggleStyle}"/>
<Border x:Name="Bd"
Grid.Column="1"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
Padding="{TemplateBinding Padding}"
SnapsToDevicePixels="true">
<ContentPresenter x:Name="PART_Header"
ContentSource="Header"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</Border>
<ItemsPresenter x:Name="ItemsHost" Grid.Row="1" Grid.Column="1" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsExpanded" Value="false">
<Setter Property="Visibility" TargetName="ItemsHost" Value="Collapsed"/>
</Trigger>
<Trigger Property="HasItems" Value="false">
<Setter Property="Visibility" TargetName="Expander" Value="Hidden"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Cursor" Value="Hand" />
<Setter TargetName="PART_grid"
Property="Background"
Value="#e6f2fa" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
The problem is that the hover effect is really terrible. In fact, if the user goes on the TreeviewItem the effect should affect only the relative children and not the whole wrapper.
How can I solve this problem and make the hover effect fall only on the single element, parent or child?
Thank you so much and have a good day everyone
c# .net wpf user-interface mvvm
c# .net wpf user-interface mvvm
edited Nov 23 '18 at 15:04
dymanoid
8,99722047
8,99722047
asked Nov 23 '18 at 15:02
FraDammFraDamm
112
112
I think the problem is that the IsMouseOver trigger is affecting TargetName="PART_grid", and every TreeViewItem has a grid with the same name.
– Robin Bennett
Nov 23 '18 at 15:21
add a comment |
I think the problem is that the IsMouseOver trigger is affecting TargetName="PART_grid", and every TreeViewItem has a grid with the same name.
– Robin Bennett
Nov 23 '18 at 15:21
I think the problem is that the IsMouseOver trigger is affecting TargetName="PART_grid", and every TreeViewItem has a grid with the same name.
– Robin Bennett
Nov 23 '18 at 15:21
I think the problem is that the IsMouseOver trigger is affecting TargetName="PART_grid", and every TreeViewItem has a grid with the same name.
– Robin Bennett
Nov 23 '18 at 15:21
add a comment |
1 Answer
1
active
oldest
votes
I suppose you are using the HierarchicalDataTemplate
for your items.
In that case, the 'terrible' hover effect is actually working exactly as you specify it. E.g. the Sergio
item will contain other sub-items. When you hover on Alessandro
, the Sergio
item actually contains the mouse too, because this Sergio
item is that large and contains all the other sub-items, including Alessandro
.
You have two options now.
Either do it in your data template, something like:
<HierarchicalDataTemplate ItemsSource="{Binding SubItems}">
<TextBlock x:Name="HeaderText" Text="{Binding Name}"/>
<HierarchicalDataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="HeaderText" Property="Background" Value="Red"/>
</Trigger>
</HierarchicalDataTemplate.Triggers>
</HierarchicalDataTemplate>
Or set the color not on the grid, but on the header only:
<Trigger Property="IsMouseOver" Value="true" SourceName="Bd">
<Setter Property="Cursor" Value="Hand" />
<Setter TargetName="Bd" Property="Background" Value="#e6f2fa" />
</Trigger>
Note that I added SourceName="Bd"
to the trigger: we only want to change the color when the corresponding header contains the mouse cursor.
Thanks a lot! Both solutions work. Finally, I managed to solve :)
– FraDamm
Nov 27 '18 at 13:22
@FraDamm, if any of the solution works for you, please upvote and accept this answer. Thanks!
– dymanoid
Nov 27 '18 at 16:36
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53448970%2fwrong-hover-effect-on-the-child-elements-of-a-wpf-treeview%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I suppose you are using the HierarchicalDataTemplate
for your items.
In that case, the 'terrible' hover effect is actually working exactly as you specify it. E.g. the Sergio
item will contain other sub-items. When you hover on Alessandro
, the Sergio
item actually contains the mouse too, because this Sergio
item is that large and contains all the other sub-items, including Alessandro
.
You have two options now.
Either do it in your data template, something like:
<HierarchicalDataTemplate ItemsSource="{Binding SubItems}">
<TextBlock x:Name="HeaderText" Text="{Binding Name}"/>
<HierarchicalDataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="HeaderText" Property="Background" Value="Red"/>
</Trigger>
</HierarchicalDataTemplate.Triggers>
</HierarchicalDataTemplate>
Or set the color not on the grid, but on the header only:
<Trigger Property="IsMouseOver" Value="true" SourceName="Bd">
<Setter Property="Cursor" Value="Hand" />
<Setter TargetName="Bd" Property="Background" Value="#e6f2fa" />
</Trigger>
Note that I added SourceName="Bd"
to the trigger: we only want to change the color when the corresponding header contains the mouse cursor.
Thanks a lot! Both solutions work. Finally, I managed to solve :)
– FraDamm
Nov 27 '18 at 13:22
@FraDamm, if any of the solution works for you, please upvote and accept this answer. Thanks!
– dymanoid
Nov 27 '18 at 16:36
add a comment |
I suppose you are using the HierarchicalDataTemplate
for your items.
In that case, the 'terrible' hover effect is actually working exactly as you specify it. E.g. the Sergio
item will contain other sub-items. When you hover on Alessandro
, the Sergio
item actually contains the mouse too, because this Sergio
item is that large and contains all the other sub-items, including Alessandro
.
You have two options now.
Either do it in your data template, something like:
<HierarchicalDataTemplate ItemsSource="{Binding SubItems}">
<TextBlock x:Name="HeaderText" Text="{Binding Name}"/>
<HierarchicalDataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="HeaderText" Property="Background" Value="Red"/>
</Trigger>
</HierarchicalDataTemplate.Triggers>
</HierarchicalDataTemplate>
Or set the color not on the grid, but on the header only:
<Trigger Property="IsMouseOver" Value="true" SourceName="Bd">
<Setter Property="Cursor" Value="Hand" />
<Setter TargetName="Bd" Property="Background" Value="#e6f2fa" />
</Trigger>
Note that I added SourceName="Bd"
to the trigger: we only want to change the color when the corresponding header contains the mouse cursor.
Thanks a lot! Both solutions work. Finally, I managed to solve :)
– FraDamm
Nov 27 '18 at 13:22
@FraDamm, if any of the solution works for you, please upvote and accept this answer. Thanks!
– dymanoid
Nov 27 '18 at 16:36
add a comment |
I suppose you are using the HierarchicalDataTemplate
for your items.
In that case, the 'terrible' hover effect is actually working exactly as you specify it. E.g. the Sergio
item will contain other sub-items. When you hover on Alessandro
, the Sergio
item actually contains the mouse too, because this Sergio
item is that large and contains all the other sub-items, including Alessandro
.
You have two options now.
Either do it in your data template, something like:
<HierarchicalDataTemplate ItemsSource="{Binding SubItems}">
<TextBlock x:Name="HeaderText" Text="{Binding Name}"/>
<HierarchicalDataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="HeaderText" Property="Background" Value="Red"/>
</Trigger>
</HierarchicalDataTemplate.Triggers>
</HierarchicalDataTemplate>
Or set the color not on the grid, but on the header only:
<Trigger Property="IsMouseOver" Value="true" SourceName="Bd">
<Setter Property="Cursor" Value="Hand" />
<Setter TargetName="Bd" Property="Background" Value="#e6f2fa" />
</Trigger>
Note that I added SourceName="Bd"
to the trigger: we only want to change the color when the corresponding header contains the mouse cursor.
I suppose you are using the HierarchicalDataTemplate
for your items.
In that case, the 'terrible' hover effect is actually working exactly as you specify it. E.g. the Sergio
item will contain other sub-items. When you hover on Alessandro
, the Sergio
item actually contains the mouse too, because this Sergio
item is that large and contains all the other sub-items, including Alessandro
.
You have two options now.
Either do it in your data template, something like:
<HierarchicalDataTemplate ItemsSource="{Binding SubItems}">
<TextBlock x:Name="HeaderText" Text="{Binding Name}"/>
<HierarchicalDataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="HeaderText" Property="Background" Value="Red"/>
</Trigger>
</HierarchicalDataTemplate.Triggers>
</HierarchicalDataTemplate>
Or set the color not on the grid, but on the header only:
<Trigger Property="IsMouseOver" Value="true" SourceName="Bd">
<Setter Property="Cursor" Value="Hand" />
<Setter TargetName="Bd" Property="Background" Value="#e6f2fa" />
</Trigger>
Note that I added SourceName="Bd"
to the trigger: we only want to change the color when the corresponding header contains the mouse cursor.
answered Nov 23 '18 at 15:36
dymanoiddymanoid
8,99722047
8,99722047
Thanks a lot! Both solutions work. Finally, I managed to solve :)
– FraDamm
Nov 27 '18 at 13:22
@FraDamm, if any of the solution works for you, please upvote and accept this answer. Thanks!
– dymanoid
Nov 27 '18 at 16:36
add a comment |
Thanks a lot! Both solutions work. Finally, I managed to solve :)
– FraDamm
Nov 27 '18 at 13:22
@FraDamm, if any of the solution works for you, please upvote and accept this answer. Thanks!
– dymanoid
Nov 27 '18 at 16:36
Thanks a lot! Both solutions work. Finally, I managed to solve :)
– FraDamm
Nov 27 '18 at 13:22
Thanks a lot! Both solutions work. Finally, I managed to solve :)
– FraDamm
Nov 27 '18 at 13:22
@FraDamm, if any of the solution works for you, please upvote and accept this answer. Thanks!
– dymanoid
Nov 27 '18 at 16:36
@FraDamm, if any of the solution works for you, please upvote and accept this answer. Thanks!
– dymanoid
Nov 27 '18 at 16:36
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53448970%2fwrong-hover-effect-on-the-child-elements-of-a-wpf-treeview%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I think the problem is that the IsMouseOver trigger is affecting TargetName="PART_grid", and every TreeViewItem has a grid with the same name.
– Robin Bennett
Nov 23 '18 at 15:21