2013年2月7日木曜日

XAML内でのデータバインド

最も簡単な例として、定番の"スライダーとテキストをbind"してみました

<Window x:Class="_130206_xamlDataBind.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <StackPanel>
            <Slider VerticalAlignment="Top" HorizontalAlignment="Center" Width="300" Margin="10"
                    Name="slider" Value="{Binding textValue}" />
            <TextBlock VerticalAlignment="Top" HorizontalAlignment="Center"
                    Text="{Binding ElementName=slider, Path=Value}" />
        </StackPanel>
    </Grid>
</Window>

0 件のコメント:

コメントを投稿