WPF-控件-ListView
<Window x:Class="DataTemplate2.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:DataTemplate2" xmlns:collections="clr-namespace:System.Collections;assembly=mscorlib" Title="MainWindow" Height="350" Width="525"> <Window.Resources> <!--数据集合--> <collections:ArrayList x:Key="stuList"> <local:Student Id="1" Name="One" Skill="C#" HasJob="True"/> <local:Student Id="2" Name="Two" Skill="Java" HasJob="True"/> <local:Student Id="3" Name="Three" Skill="PHP" HasJob="False"/> <local:Student Id="4" Name="Four" Skill="C++" HasJob="True"/> <local:Student Id="5" Name="Five" Skill="C" HasJob="True"/> </collections:ArrayList> <!--DataTemplate--> <DataTemplate x:Key="nameTD"> <TextBox x:Name="textBoxName" Text="{Binding Name}"/> </DataTemplate> <DataTemplate x:Key="SkillTD"> <TextBox x:Name="textBoxSkill" Text="{Binding Skill}"/> </DataTemplate> <DataTemplate x:Key="HasJobTD"> <CheckBox x:Name="checkBox" IsChecked="{Binding HasJob}"/> </DataTemplate> </Window.Resources> <Grid Margin="5"> <ListView x:Name="listViewStudent" ItemsSource="{StaticResource stuList}"> <ListView.View> <GridView> <GridViewColumn Header="ID" DisplayMemberBinding="{Binding Id}"/> <GridViewColumn Header="姓名" CellTemplate="{StaticResource nameTD}"/> <GridViewColumn Header="技术" CellTemplate="{StaticResource SkillTD}"/> <GridViewColumn Header="工作" CellTemplate="{StaticResource HasJobTD}"/> </GridView> </ListView.View> </ListView> </Grid> </Window>
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 一次Java后端服务间歇性响应慢的问题排查记录
· dotnet 源代码生成器分析器入门
· ASP.NET Core 模型验证消息的本地化新姿势
· 对象命名为何需要避免'-er'和'-or'后缀
· SQL Server如何跟踪自动统计信息更新?
· 官方的 MCP C# SDK:csharp-sdk
· 一款 .NET 开源、功能强大的远程连接管理工具,支持 RDP、VNC、SSH 等多种主流协议!
· 提示词工程师自白:我如何用一个技巧解放自己的生产力
· 一文搞懂MCP协议与Function Call的区别
· 如何不购买域名在云服务器上搭建HTTPS服务