假设我有一个如下所示的用户控件,如何从控件外部将某些内容绑定到"G1“网格的ActualWidth?
<UserControl x:Class="Blah">
<WrapPanel>
<Grid x:Name="G1">
...
</Grid>
<Grid>
...
</Grid>
</WrapPanel>
</UserControl>发布于 2008-11-21 02:52:58
如果要绑定到使用此用户控件的外部控件,请在UserControl代码后台声明一个DependencyProperty,然后将G1绑定到该属性。并将外部控件的属性绑定到用户控件的DependencyProperty。这就像是2级的间接性。
https://stackoverflow.com/questions/307664
复制相似问题