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;
后台绑定数据
查看全文
相关阅读:
jQuery内核详解与实践读书笔记2:破解jQuery选择器接口1
jQuery内核详解与实践读书笔记1:原型技术分解2
jQuery内核详解与实践读书笔记1:原型技术分解1
MyEclipse常用配置图解
python3-datetime.date详解(一)
PYTHON3-LIST.SORT(),SORTED()方法详解。
为什么要学习?
sqlserver数据库 Schema
Nop源码分析三
Nop源码分析二
原文地址:https://www.cnblogs.com/javawebsoa/p/2458007.html
最新文章
nginx+tomcat+redis sesson id主从复制
LINUX下分区命令Parted详解
Linux常用命令
Oracle数据库如何创建DATABASE LINK?
Oracle Merge into 详细介绍
Oracle查询表空间使用情况
分享一款漂亮的VS2019暗黑主题
MythXinWCF通用宿主绿色版V1.2发布,及服务启动相关说明
MythXinWCF通用宿主绿色版V1.1
MythXinWCF通用宿主绿色版发布(一键启动,方便快捷)
热门文章
如何禁止一个输入框输入
一年了--
解决报错问题:At least one JAR was scanned for TLDs yet contained no TLDs.
JsonArray和JsonObject遍历方法
JSONArray和JSONArray区别
深入浅出数据仓库中SQL性能优化之Hive篇
使用virtualenv Django 创建应用程序的前期配置
com.mchange.v2.c3p0.impl.NewProxyConnection cannot be cast to com.mysql.jdbc.Connection 问题的解决
怎么在SQL Server 2008中还原.mdf数据文件
关于面试的那些事。。。
Copyright © 2011-2022 走看看