zoukankan      html  css  js  c++  java
  • WPF Demo8

    namespace Demo10
    {
        public class Student
        {
            private string name;
    
            public string Name
            {
                get { return name; }
                set { name = value; }
            }
        }
    }
    

      

    <Window x:Class="Demo10.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">
        <StackPanel>
            <TextBlock Margin="5" Text="Student Name:"/>
            <TextBox Margin="5" x:Name="txtName"/>
            
            <TextBlock Margin="5" Text="Student List:"/>
            <ListBox Margin="5" x:Name="lsbList"/>
        </StackPanel>
    </Window>
    using System.Collections.Generic;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    
    namespace Demo10
    {
        /// <summary>
        /// MainWindow.xaml 的交互逻辑
        /// </summary>
        public partial class MainWindow : Window
        {
            public MainWindow()
            {
                InitializeComponent();
    
                List<Student> stuList = new List<Student>()
                {
                    new Student(){Name ="Tim"},
                    new Student(){Name ="Tom"},
                    new Student(){Name ="JIM"},
                    new Student(){Name ="Kite"},
                    new Student(){Name ="quanquan"},
                };
    
                this.lsbList.ItemsSource = stuList;
                this.lsbList.DisplayMemberPath = "Name";
    
                Binding binding = new Binding("SelectedItem.Name") { Source=this.lsbList};
                this.txtName.SetBinding(TextBox.TextProperty,binding);
            }
        }
    }
    

  • 相关阅读:
    Typora的使用
    selenium中webdriver提供的八大定位元素方法
    JAVA的Data和Timestamp的相互转换
    Jmeter设置参数作为断言依据
    Springboot +Poi 导入Excel表格
    window.location.reload();
    带参数的链接跳转
    Layui结束时间不能小于开始时间
    后台返回数据渲染Layui表格
    Layui中layedit模板的使用
  • 原文地址:https://www.cnblogs.com/YYkun/p/6867244.html
Copyright © 2011-2022 走看看