zoukankan
html css js c++ java
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;
后台绑定数据
查看全文
相关阅读:
C-Scanf连续调用多次并且存在%c的问题
JavaScript-常用正则函数(适合忘记时看)
JavaScript-深入理解JavaScript(一、预编译和执行过程)
Python-代码性能优化技巧
Python-深入理解元类(metaclass)
Python-编码之大彻大悟
Python-正确使用Unicode
Fiddler-抓取安卓手机APP请求地址
unity, access sprite of UGUI Image
unity, UGUI Text outline
原文地址:https://www.cnblogs.com/javawebsoa/p/2458007.html
最新文章
针对后缀删除文件的方法
在一个工程管理多个应用-b
过滤菜鸟的iOS面试题-b
获取网页上数据(图片、文字、视频)-b
iOS开发进阶
iPhone 7-b
微信支付-b
iOS视频压缩存储至本地并上传至服务器-b
UILabel设置行间距和字间距并计算高度-b
一种高斯模糊渐变动画的实现-b
热门文章
hibernate开发流程
struts2 表单验证
struts2 的国际化
struts2实现简单文件上传
struts2自定义日期类型转换器
struts2开发流程及配置,域对象对数据存储的3种方式
使用 log4j 2记录日志
java开发中国际化
java web中get请求中文乱码在filter中解决
c3p0数据库连接池管理
Copyright © 2011-2022 走看看