Silverlight 3 – Element to Element Binding
Posted by Ramprasad Navaneethakrishnan on April 24, 2009
Hi Folks..
Silverlight 3 Beta 1 is released and as expected, Microsoft has added some cool features. I am very excited about this new feature called Element to Element binding and lets do a walk through.
Element To Element Binding let binding a control’s property directly with another control’s property. For example, we can bind the value property of a slider control directly to the width property of a Rectangle control in the XAML iteself. Let’s see the example..
- Make sure you have installed the followng Silverlight 3 sdk and tools
- Create a Silverlight application in the visual studio and in Page.xaml paste the following lines
- < Grid x:Name=”LayoutRoot” Background=”White”> <RowDefinition></RowDefinition>
<RowDefinition ></RowDefinition>
</Grid.RowDefinitions>
<Slider x:Name=”mySlider” Grid.Row=”0″ Minimum=”0″ Maximum=”400″ Value=”50″ Orientation=”Horizontal” ></Slider>
<Image Source=”DSC00443.JPG” Width= “{Binding Value, ElementName=mySlider}” Height=”{Binding Value, ElementName=mySlider}” Grid.Row=”1″ ></Image>
</Grid>
<Grid.RowDefinitions> Note that we have binded the width property of the image with the value property of the Slider control like this -
- Width =”{ Binding Value, ElementName=mySlider}”
- Now go ahead and hit the F5 button
- Drag the Slider control and see the width of the image getting changed according to the value of the Slider control.
Cool. Isn’t it.
Please give your feedback on this post.
Thanks,
Ramprasad
Possibly related posts: (automatically generated)
This entry was posted on April 24, 2009 at 1:08 PM and is filed under Silverlight. Tagged: Cool features, Element to Element Binding, Microsoft, New features, Silverlight, Silverlight 3, Silverlight 3 Beta 1, Silverlight 3 new features, Silverlight Tools, Slider control. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
Silverlight 3 - Out-of-the-Browser Applications « Dotnetdreamer’s Weblog said
[...] Silverlight 3 – Element to Element Binding [...]
Robs Usability Development : Silverlight, ASP.NET, Ajax, Agile, MVC & Volta » Silverlight & Expression Blend 3 said
[...] Element to Element Binding [...]