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;
后台绑定数据
查看全文
相关阅读:
Android “swipe” vs “fling”
Parcel
ViewConfiguration 和 ViewConfigurationCompat
Hive记录-配置支持事务管理hive-site.xml
SQL记录-资源正忙online或nowait
SQL记录-解锁和dbms_job操作
Java记录-SpringMVC整合Echarts画地图加散点图
Hive记录-impala常用命令
Hive记录-Sqoop常用命令
Linux记录-shell一行代码杀死进程(收藏)
原文地址:https://www.cnblogs.com/javawebsoa/p/2458007.html
最新文章
并发容器之CopyOnWriteArrayList(转载)
分布式唯一ID生成方案是什么样的?(转)
Mybatis 基本使用
Redis: 用redis实现分布式锁,秒杀案例(转)
分布式锁原理及实现(转)
SqlServer共用表达式(CTE)With As
SqlServer中Sql查看存储过程
SqlServer中 CREATE PARTITION FUNCTION使用
SqlServer代理作业
Sqlserver中PIVOT行转列透视操作
热门文章
DDD领域模型企业级系统Unity(五)
DDD领域模型企业级系统Linq的CRUD(四)
SqlServerDBCC SHRINKFILE不起作用
SqlServer中查看索引的使用情况
Drawable.Callback
Canvas的save和restore
ps如果换背景
梨
自定义ActionBar图标
索引颜色模式
Copyright © 2011-2022 走看看