Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

IsExpanded not getting bind in TreeViewItem Style when Style is inherited using BasedOn tag

$
0
0

Hi Experts,

I have created a customer style for TreeViewItem style in my themes. Now on my actual screen i have MVVM binding.

Now on my actual screen i want to override by TreeViewItem style in order to bind IsExpanded and IsSelected property to my view model. This binding works fine of i am not inheriting TreeViewItem style however it doesnt work when I am inheriting using BasedOn tag in style.

<Style TargetType="{x:Type TreeViewItem}" BasedOn="{StaticResource {x:Type TreeViewItem}}"><Setter Property="IsExpanded"  Value="{Binding IsExpanded,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" /><Setter Property="IsSelected"  Value="{Binding IsSelected,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" /></Style>

Note: I have IsExpanded and IsSelected properties in my ViewModel.

Can some one help me how can i bind IsExpanded when we are using BasedOn.

I have created a sample application demonstrating my problem which can be found using following link.

https://1drv.ms/u/s!AgUQd_BZ1AEoiOlytdHBE02YSgvWwg





Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>