Is there a way to bind to the instance of another control? Something like this:
<Button x:Name="Foo" Content="Foo" />
<local:CustomControl OtherControl="{Binding Foo}" />
I’ve tried setting DataContext to “this” in the constructor of MainPage but it doesn’t seem to work.
CustomControl is defined something like this:
class CustomControl
{
public FrameworkElement OtherControl { get; set; }
}
Not sure what you trying to do but in Silverlight 3 you can use element binding to bind to a property on a control.
In code you could always analyze the binding and get the element from that?
control.GetBindingExpression(Property).ParentBinding.Source