The
HeaderTemplate
has its own
DataContext
, so you can't bind directly to properties on the parent
DataContext
. If you examine the output window, you will see errors telling you that the property was not found.
You need to use a
RelativeSource
binding to access the parent
DataContext
:
<UserCntrl:RoundedButton x:Name="btnRoundedButton"
Visibility="{Binding Path=DataContext.IsbtnVisibility,
RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type GroupBox}}, Converter={StaticResource FalseToCollapsedConverter}}"
/>
WPF GroupBox HeaderTemplate and DataBinding - Stack Overflow[
^]