我正在尝试在 FlowDocumentPageViewer
内的 FlowDocument
内创建一个 Table
,如 本教程。我以前从未在 WPF 中创建过表,并且希望有一个可以绑定的 ItemsSource
属性,就像使用 ListBox
一样。我想为每一行自定义模板,并且希望每一行的源都是我传递到整个表的集合中的一个项目。因此,我将有一个将传递到表的 List
实例,并且每行将显示一个 MyClass
。我怎样才能做到这一点?我不想在 FlowDocument
中使用 Table
吗?我想使用某种表格格式的原因是这样我可以拥有适用于所有行的单行列名称。
I'm trying to create a Table
inside a FlowDocument
inside a FlowDocumentPageViewer
, as seen in this tutorial. I've never created a table in WPF before, and I was expecting there to be an ItemsSource
property to which I could bind, like with a ListBox
. I want to customize the template for each row, and I want each row's source to be an item in a collection that I pass to the entire table. So I'll have a List<MyClass>
instance that would be passed to the table, and each row would show a single MyClass
. How can I do that? Do I not want to use a Table
within a FlowDocument
? The reason I wanted to use some kind of tabular format is so that I can have a single row of column names that applies to all the rows.
发布评论
评论(1)
我想我想要的是使用
ListView
,感谢 本教程:I think what I wanted was to use
ListView
, thanks to this tutorial: