且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

WPF应用程序-无法显示数据网格中列表中的数据

更新时间:2023-10-19 18:39:22

所有这些字段都必须使用至少一个吸气剂公开为公共属性(这是绑定系统的要求)。然后,您需要绑定到属性或只使用自动生成的列。

All those fields need to be exposed as public properties with at least a getter (this is a requirement of the binding-system). Then you need to bind to the properties or just use the auto-generated columns.

public string Name { get; private set; }





<DataGridTextColumn Header="Name" Binding="{Binding Name}" />

如果您不熟悉WPF,我强烈建议您阅读一些MSDN上的文章。例如数据绑定概述

If you are new to WPF i highly recommend reading some of the articles on MSDN. e.g. the Data Binding Overview.