English 中文(简体)
服从于银星的另一控制
原标题:Binding to another control in Silverlight
  • 时间:2009-10-14 16:58:24
  •  标签:

是否有办法约束另一种控制? 与此类似:

<Button x:Name="Foo" Content="Foo" />
<local:CustomControl OtherControl="{Binding Foo}" />

我试图在主食建筑商中确定数据内容,但似乎没有工作。

习惯法的定义类似:

class CustomControl
{
    public FrameworkElement OtherControl { get; set; }
}
最佳回答

不能确定你试图做些什么,但在银星3中,你可以使用对控制的财产具有约束力的要素。

<Button x:Name="Foo" Content="Foo" />
<local:CustomControl x:Name="control" Property="{Binding Path=Content, ElementName=Foo}" />

在法典中,你可以永远分析具有约束力的内容并从中获取内容?

控制。 育儿。 来源

问题回答

在银目中不可能做到:

Silverlight 2 doesn’t allow you to bind one element to another element. Instead, all bindings are to data objects. (You could get around this using an intermediate object, but the added inconvenience means it’s rarely worthwhile.)

<Button x:Name="Foo" Content="Foo" />
<local:CustomControl x:Name="control" OtherControl="{Binding ElementName=Foo}" />




相关问题
热门标签