WPF学习(5) -- WPF绑定-一、双向绑定

1.代码示例

<Window x:Class="学习.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:学习"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">

    <Grid>
        <StackPanel>
            <Slider x:Name="slider" Margin="10"/>
            <TextBox Height="30"  Margin="10" Text="{Binding ElementName=slider,Path=Value}"/>
            <TextBox Height="30"  Margin="10" Text="{Binding ElementName=slider,Path=Value}"/>
            <TextBox Height="30"  Margin="10" Text="{Binding ElementName=slider,Path=Value}"/>
        </StackPanel>
    </Grid>
</Window>

2.代码结果

上一篇:搭建hadoop+spark完全分布式集群环境


下一篇:装饰设计模式