Windows Phone 8.1 Binding 用元素值绑定

network | | 访问(64)
<Grid x:Name="LayoutRoot" Background="Transparent">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>

    <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,40,0,28">
        <TextBlock x:Name="ApplicationTitle" Text="MY APPLICATION" FontSize="20"/>
        <TextBlock x:Name="PageTitle" Text="用元素值绑定" Margin="9,-7,0,0" FontSize="60"/>
    </StackPanel>

    <StackPanel x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
        <TextBlock FontSize="25"  Name="textBlock1" Text="圆形的半径会根据slider控件的值而改变" />
        <Slider Name="slider" Value="50" Maximum="400"/>
        <TextBlock FontSize="25" Name="textBlock2" Text="半径为:"/>
        <TextBlock Name="txtblk" Text="{Binding ElementName=slider, Path=Value}" FontSize="48"/>
        <Ellipse  Height="{Binding ElementName=slider, Path=Value}" 
                      Width="{Binding ElementName=slider, Path=Value}"
                      Fill="Red" Name="ellipse1" Stroke="Black" StrokeThickness="1"/>
    </StackPanel>
</Grid>