我使用的是bindable FlowDocument items控件,可以在这里找到:
http://msdn.microsoft.com/en-us/magazine/dd569761.aspx
它像广告中所说的那样工作得很好;但是,我希望在此基础上进行扩展。我希望能够为ItemsPanel指定ItemsPresenter,就像为ItemsControl指定一样。我的目标是为表格添加一个页脚。
使用网站上的示例:
<flowdoc:ItemsContent ItemsSource="{Binding Source= {StaticResource DataSource},XPath=FortressGuys/Person}" >
<flowdoc:ItemsContent.ItemsPanel>
<DataTemplate>
<flowdoc:Fragment>
<Table BorderThickness="1" BorderBrush="Black">
<TableRowGroup flowdoc:Attached.IsItemsHost="True">
<TableRow Background="LightBlue">
<TableCell>
<Paragraph>First name</Paragraph>
</TableCell>
<TableCell>
<Paragraph>Last name</Paragraph>
</TableCell>
</TableRow>
</TableRowGroup>
<TableRowGroup>
<!-- ITEMS PRESENTER -->
</TableRowGroup>
<TableRowGroup>
<TableRow>
<TableCell>
<Paragraph>My Amazing Footer</Paragraph>
</TableCell>
</TableRow>
</TableRowGroup>
</Table>
</flowdoc:Fragment>
</DataTemplate>
</flowdoc:ItemsContent.ItemsPanel>
<flowdoc:ItemsContent.ItemTemplate>
<DataTemplate>
<flowdoc:Fragment>
<TableRow>
<TableCell>
<Paragraph>
<flowdoc:BindableRun BoundText="{Binding XPath=@FirstName}" />
</Paragraph>
</TableCell>
<TableCell>
<Paragraph>
<flowdoc:BindableRun BoundText="{Binding XPath=@LastName}"/>
</Paragraph>
</TableCell>
</TableRow>
</flowdoc:Fragment>
</DataTemplate>
</flowdoc:ItemsContent.ItemTemplate>
</flowdoc:ItemsContent>它最终会看起来像这样:
First Name Last Name
----------------------
Nancy Davolio
Andrew Fuller
----------------------
My Awesome Footer有人知道这将如何实现吗?
发布于 2011-03-02 03:26:56
在进一步回顾之后,我找到了答案。IsItemsHost属性告诉控件放置项目的位置。
flowdoc:Attached.IsItemsHost="True"从第一个TableRowGroup中删除该属性,并将其添加到第二个行组中:
<TableRowGroup flowdoc:Attached.IsItemsHost="True">
<!-- ITEMS PRESENTER -->
</TableRowGroup>https://stackoverflow.com/questions/5159026
复制相似问题