I am new to the C# and trying the elements bindings. I created a slider bar and textbox to control the fontsize of textblock. The following snippet is not working,
<TextBlock Name="lblText" Height="23" HorizontalAlignment="Left" Margin="20,20,0,0" Text="TextBlock" VerticalAlignment="Top" />
<Slider Name="sldValue" Value="{Binding ElementName=txbValue, Path=Text, Mode=TwoWay}" Height="23" HorizontalAlignment="Left" Margin="20,60,0,0" VerticalAlignment="Top" Width="200" Minimum="1" Maximum="40"/>
<TextBox Name="txbValue" Text="{Binding ElementName=lblText, Path=FontSize, Mode=TwoWay}" Height="23" HorizontalAlignment="Left" Margin="20,100,0,0" VerticalAlignment="Top" Width="120" />
However, if I move the binding of textbox to textblock, it works well,
<TextBlock Name="lblText" FontSize="{Binding ElementName=txbValue, Path=Text, Mode=TwoWay}" Height="23" HorizontalAlignment="Left" Margin="20,20,0,0" Text="TextBlock" VerticalAlignment="Top" />
<Slider Name="sldValue" Value="{Binding ElementName=txbValue, Path=Text, Mode=TwoWay}" Height="23" HorizontalAlignment="Left" Margin="20,60,0,0" VerticalAlignment="Top" Width="200" Minimum="1" Maximum="40"/>
<TextBox Name="txbValue" Height="23" HorizontalAlignment="Left" Margin="20,100,0,0" VerticalAlignment="Top" Width="120" />