XML : How to bind UIElements in XML?

I have a class:

  class LinkedTextBox: TextBox  {      public TextBox TextBoxA { get; set; }      public TextBox TextBoxB { get; set; }  }    

Say I have two Textboxes:

      <TextBox x:Name="txt1" />      <TextBox x:Name="txt2" />    

How do I to specify that TextBoxes on my Xml?

My tests:

(1) "The TypeConverter for "TextBox" does not support converting from a string."

      <local:LinkedTextBox TextBoxA="txt1" TextBoxB="txt2" />    

(2) "A 'Binding' cannot be set on the 'TextBoxA' property of type 'LinkedTextBox'. A 'Binding' can only be set on a DependencyProperty of a DependencyObject."

      <local:LinkedTextBox           TextBoxA="{Binding ElementName=txt1}"            TextBoxB="{Binding ElementName=txt2}"            />    

I think that there is an obvious way to do, but I don't know how to...

No comments:

Post a Comment