标签:style blog http color 使用 os strong io
<Window x:Class="WpfApplication1.Test2" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Test2" Height="600" Width="600"> <Grid> <StackPanel> <Slider Name="sliderFontSize" Margin="3" Minimum="1" Maximum="40" Value="10" TickPlacement="TopLeft" /> <TextBlock Margin="10" Text="Simple Text" FontSize="{Binding ElementName=sliderFontSize,Path=Value,Mode=OneWay}" HorizontalAlignment="Left" VerticalAlignment="Center" /> </StackPanel> </Grid> </Window>
也可以使用代码进行数据绑定,以下代码完成和以上代码相同的绑定:
Binding binding = new Binding(); binding.Source = sliderFontSize; binding.Path = new PropertyPath("Value"); binding.Mode = BindingMode.TwoWay; txtBTest.SetBinding(TextBlock.FontSizeProperty, binding);
标签:style blog http color 使用 os strong io
原文地址:http://www.cnblogs.com/jiao1855/p/3887346.html