Live Chat Icon For mobile
Live Chat Icon

WPF FAQ - Custom Controls

Find answers for the most frequently asked questions
Expand All Collapse All

You can bind B’s Width and Height to that of A’s. For example, in the XAML where you define B:

[XAML]
<local:B Width='{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type A}}, Path=Width}' /local:B>

If there is an ActualWidth property in A, then you might want to bind B’s Width to that instead. Do the same for Height.

Permalink

Share with

Share on twitter
Share on facebook
Share on linkedin

Couldn't find the FAQs you're looking for?

Please submit your question and answer.