I have a toolbar using ItemsSource bind to my main VM.
each item is a type of ToolBarItem, that has, Icon, Command, etc…
One of my toolbar command is to set IsOptionsDialogOpen on my main VM (not the ToolBarItem), I am binding PopUp.IsOpen (which is part of my ToolBar template) to this property, but it never access it, the reason is, it’s part of my Main VM, rather than the ToolBarItem class.
I tried binding this way:
IsOpen="{Binding IsOptionsDialogOpen, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ToolBar}}}"
but that didn’t work either, any ideas ?
RelativeSourcein your binding [if it was successful] will returnToolBaritself, not it’sDataContext. Change your binding: