runxinzhi.com
首页
百度搜索
WPF绑定ListBox
class Student { public string sno { get; set; } public string sname { get; set; } public string sage { get; set; } }
定义实体类Student
<ListBox Height="163" HorizontalAlignment="Left" Margin="12,12,0,0" Name="listBox1" VerticalAlignment="Top" Width="217" > <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding sno}"/> <TextBlock Text="{Binding sname}"/> <TextBlock Text="{Binding sage}"/> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox>
XAML页面设置绑定格式和字段
List<Student> students = new List<Student>(); students.Add(new Student { sno = "1", sname = "王井", sage = "20" }); students.Add(new Student { sno = "2", sname = "高瑞", sage = "21" }); students.Add(new Student { sno = "3", sname = "刘欢", sage = "21" }); listBox1.Items.Clear(); listBox1.ItemsSource = students;
后台绑定数据
相关阅读:
QQ邮箱自动删除邮件脚本
5ppm高精度自动同步标准化考场时钟系统
GPS时钟之户外防水防雷细节
C/C++ Compile Run插件,使用某些头文件出现重定义的错误,解决方法为修改MinGW的路径
7zip 通过指令压缩 仅存储压缩 分压缩卷 / 对文件夹里的文件进行解压,解压到对应文件名所在的文件夹上
循环队列FIFO
cglib和jdk代理的字节码生成配置
SpringXML的beans标签后的一串网址相关的属性有什么用
service和server这两个单词的区别
没有代码提示的地方,前后引用记得用复制不要手打
原文地址:https://www.cnblogs.com/javawebsoa/p/2458007.html
最新文章
RPC
常用英文
python模块小问题
支付宝当面付参数
ubuntu 20.04 Desktop创建
MongoDB 随笔
在数据库中查询以逗号分割的数据
c 语言调试所遇到的问题
ubuntu 12.04 source.list
(转)eclipse调试错误No source available for "_dl_debug_state() 解决方案
热门文章
java relectionjava 反射
ubuntu 安装 opensshserver出问题
转载:eclipse c inclusion <stdio.h>
gcc:编译 expected declaration specifiers or ‘...’ before
lsoflinux强大的工具
规则引擎Drools在SpringBoot中使用
从台体的体积公式谈起
域名
docsify命令行操作
数据脱敏简介
Copyright © 2020-2023
润新知