how to bind width of child element to width of parent element in silverlight

后端 未结 6 1279
南笙
南笙 2021-01-30 20:15

I have a grid whose width is \"1*\". So the actual width decided at runtime I think. Within that grid I have another grid whose width I want to set to the runtime width of paren

6条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-30 20:44

     Width="{Binding Width, RelativeSource={RelativeSource AncestorType={x:Type Parent}, Mode=FindAncestor}}"
    

    if both controls DataContext is different.

提交回复
热议问题