WPF - Adopt size of parent WPF - Adopt size of parent wpf wpf

WPF - Adopt size of parent


I was trying to do something similar, found this to work well:

    Width="{Binding RelativeSource={RelativeSource FindAncestor,     AncestorType={x:Type ListBox}},Path=ActualWidth}"

Check out: social.msdn.microsoft


The Width and Height properties are primarily designed for setting requested dimensions.

If you are using dynamic layouts with stretching, etc. bind to the ActualWidth and ActualHeight properties:

<Binding RelativeSource="{RelativeSource ...}" Path="ActualWidth"/>