Introduction
In this blog I have taken on slider, one textbox and one textblock controls. this code example uses value of slider for setting the text of textbox and for increasing the font size value of textblock
to do the above task, I have use the Element Binding
XAML Code
<Window
x:Class="Example02.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Example
01" Height="300"
Width="300">
<Grid>
<Grid.RowDefinitions
>
<RowDefinition
Height="60px" />
<RowDefinition
Height="40px" />
<RowDefinition
Height="40px" />
<RowDefinition
Height="*" />
</Grid.RowDefinitions>
<ComboBox
Name="FontNameList"
ItemsSource="{Binding
Source={x:Static
Fonts.SystemFontFamilies}}"
Height="22"
SelectedIndex="22"
Grid.Row="0"/>
<Slider
Name="fontSizeSlider"
Minimum="5"
Maximum="100"
Value="10"
Grid.Row="1" />
<TextBox
Name="SizeTextBox"
Text="{Binding
ElementName=fontSizeSlider,
Path=Value}"
Grid.Row="2"/>
<TextBlock
Text="Example 01"
FontFamily="{Binding
ElementName=FontNameList,
Path=Text}"
FontSize="{Binding
ElementName=SizeTextBox,
Path=Text}"
Grid.Row="3"/>
</Grid>
</Window>
Former memberPosted Jun 5, 2013, 3:29 AM
Thanx
Ashwani TyagiPosted Jun 4, 2013, 11:57 PM
Nice Blog