|
Silverlight 3 Element To Element Binding
Silverlight 3 among its other features includes element to element binding. This was always available in WPF but somehow missing in Silverlight 1 and 2. And now Silverlight 3 has bridged that gap. Element to element binding can reduce code when used properly. In this post I will show you how to use this feature.
Example
In this very basic example I will use two controls, a TextBlock and a Slider. When the slider is moved, the value in TextBlock changes accordingly.
<StackPanel x:Name="LayoutRoot"> <TextBlock Width="100" Foreground="Blue" HorizontalAlignment="Center" Text="{Binding Value, ElementName=slider1}" /> <Slider x:Name="slider1" Minimum="0" Maximum="100" Width="200" /> </StackPanel>
Here is a screenshot of the output produced by XAML above.
Element binding can come in very handy in certain scenarios. An example can be making all fields read-only based on a status flag. Rather than writing C# code, this can be done easily and cleanly with element binding.
Leave a Reply
Get Updates By Email
Popular Post
- LINQ To SQL Tutorial
- LINQ To SQL Join On Multiple Conditions
- Code Sample: Programmatically Download File Using C#
- Free Icons And Images With Visual Studio 2008
- Windows 7 Control Panel In Classic Mode
- Dynamic Sort With LINQ
- Use SqlConnection With LINQ To SQL
- StyleCop Tutorial
- Write To Vista Event Log Using C#
- More Details Emerge On Microsoft Master Certification
Tag Cloud
Code Snippets
- Get Current Windows User In C#
- Get Width And Height Of Image In C#
- Get Windows Registry Size With WMI And C#
- Reverse Array Elements Using C#
- Convert Hexadecimal To Number In C#
- Get Free Disk Space Using T-SQL
- SQL Server 2008 – Get All Indexes In A Database
- Get Name Of Current Executing Assembly In C#
- Get CD Or DVD Drive Information Using WMI And C#
- Get Last Row From Table Using LINQ To SQL

