The viewmodel in all likelihood will be the DataContext, so the binding should be a RelativeSource binding with a respective path which needs to explicity target the DataContext as the new source is the RelativeSource : {Binding DataContext. IsItemSelected, RelativeSource={RelativeSource AncestorType=TreeViewItem}} As noted in my comment it might be advisable to extract this logic from the ControlTemplate as this leaves its bounds. One method would be subclassing the ToggleButton and exposing a public property for the image which then can be changed via a Style.
The viewmodel in all likelihood will be the DataContext, so the binding should be a RelativeSource binding with a respective path which needs to explicity target the DataContext as the new source is the RelativeSource: {Binding DataContext. IsItemSelected, RelativeSource={RelativeSource AncestorType=TreeViewItem}} As noted in my comment it might be advisable to extract this logic from the ControlTemplate as this leaves its bounds. One method would be subclassing the ToggleButton and exposing a public property for the image which then can be changed via a Style.
Thanks but I have no problem binding to IsChecked or even binding to the parents IsSelected property (the parent template is a TreeViewItem. Its just binding to the parent custom propert IsItemSelected which is part of my ViewModel for the TreeViewItem. – infensus Aug 2 at 1:26 1 ControlTemplates should be fully self-contained, I do not think that binding to anything outside is a good idea... – H.B.Aug 2 at 1:29 Thanks H.
B - I basically want to change the color of the expand image based on whether the property IsItemSelected is true -- any ideas? – infensus Aug 2 at 1:31 1 You could potentially subclass ToggleButton (something like ImageToggleButton) which exposes the Image's source as a public dependency property, then you can define a style for the button, which on trigger changes this property. – H.B. Aug 2 at 1:36 Ha such a simple great suggestion thanks :) Maybe post it as an answer then I can mark this as answered – infensus Aug 2 at 1:37.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.