• WPF Demo17 数据绑定


    实例一:以资源的形式实现

    namespace 数据绑定1
    {
        public class Student
        {
            public int Id { get; set; }
            public string Name { get; set; }
            public int Age { get; set; }
        }
    }
    
    <Window x:Class="数据绑定1.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:local="clr-namespace:数据绑定1"  
            Title="MainWindow" Height="350" Width="525">
        <StackPanel Background="LightBlue">
            <StackPanel.DataContext>
                <local:Student Id="6" Age="29" Name="Time"/>
            </StackPanel.DataContext>
            <Grid>
                <StackPanel>
                    <TextBox Text="{Binding Path=Id}" Margin="5" Background="Red" />
                    <TextBox Text="{Binding Path=Name}" Margin="5" Background="Red" />
                    <TextBox Text="{Binding Path=Age}" Margin="5" Background="Red" />
                </StackPanel>
            </Grid>
        </StackPanel>
    </Window>

  • 相关阅读:
    字符串-06. IP地址转换
    字符串-05. 字符串循环左移
    字符串-04. 字符串逆序
    BZOJ 3110
    UOJ 34 fft板子
    BZOJ 2716
    BZOJ 2243
    BZOJ 3697
    BZOJ 1176
    BZOJ 2599
  • 原文地址:https://www.cnblogs.com/YYkun/p/6872990.html
Copyright © 2020-2023  润新知