Dusan
Dusan

Reputation: 5144

WPF TreeView and Disabled Item

I have a WPF TreeView with some of the items disabled - IsEnabled = false.

When I click on the disabled item, the parent item gets selected (I don't like this). I want to stay on the current item when some disabled item is clicked. Is this possible and how?

Upvotes: 3

Views: 1516

Answers (1)

LPL
LPL

Reputation: 17083

Bind IsHitTestVisible to IsEnabled. Something like this:

<Style TargetType="TreeViewItem">
    <Setter Property="IsHitTestVisible" Value="{Binding IsEnabled}" />
</Style>

Upvotes: 3

Related Questions