Objective:In this article I am going to discuss new feature of Silverlight 3.0 called Element to Element Binding. I will discuss three samples to understand Element to Element Binding.Example I will take an example to explain Element to Element binding. I will bind value of slider control to text of a text block. First I will bind using ValueChanged event of slider control (Sample #1) then I will move to accomplish same task using Element to Element Binding (Sample#2)Element to Element BindingThis is a new feature provided by Silverlight 3.0. This allows one element to bind other element's property. This feature is very useful when you want to tie two objects such that when value of one objects changes it got reflected in other object's value. Sample #1 [Event Handler Approach]
namespace ElementBindingDemo{ public partial class MainPage : UserControl { public MainPage() { InitializeComponent(); topSlider.ValueChanged += new RoutedPropertyChangedEventHandler<double>(topSlider_ValueChanged); } void topSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e) { //throw new NotImplementedException();' topTextBlock.Text = topSlider.Value.ToString(); } }}OutputConclusion In this article, I showed three samples on element to element binding. Thanks for reading.
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: