Mega Code Archive

 
Categories / VB.Net Tutorial / WPF
 

Bind to a Property of a UI Element

<Window      x:Class="WpfApplication1.Window1"     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     Title="WPF" Height="100" Width="260">     <StackPanel>         <Slider Name="slider"                 Margin="4" Interval="1"                 TickFrequency="1"                 IsSnapToTickEnabled="True"                 Minimum="0" Maximum="100"/>         <StackPanel Orientation="Horizontal" >             <TextBlock Width="Auto" HorizontalAlignment="Left" Margin="4"                         Text="The value property of the slider is:" />             <TextBlock Width="40" HorizontalAlignment="Center" Margin="4"                         Text="{Binding                                ElementName=slider,                                Path=Value}" />         </StackPanel>     </StackPanel> </Window>