首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用ItemsPresenter的WPF FlowDocument

使用ItemsPresenter的WPF FlowDocument
EN

Stack Overflow用户
提问于 2011-03-02 02:58:51
回答 1查看 2.6K关注 0票数 3

我使用的是bindable FlowDocument items控件,可以在这里找到:

http://msdn.microsoft.com/en-us/magazine/dd569761.aspx

它像广告中所说的那样工作得很好;但是,我希望在此基础上进行扩展。我希望能够为ItemsPanel指定ItemsPresenter,就像为ItemsControl指定一样。我的目标是为表格添加一个页脚。

使用网站上的示例:

代码语言:javascript
复制
<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>

它最终会看起来像这样:

代码语言:javascript
复制
First Name   Last Name
----------------------
Nancy        Davolio
Andrew       Fuller
----------------------
My Awesome Footer

有人知道这将如何实现吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-03-02 03:26:56

在进一步回顾之后,我找到了答案。IsItemsHost属性告诉控件放置项目的位置。

代码语言:javascript
复制
 flowdoc:Attached.IsItemsHost="True"

从第一个TableRowGroup中删除该属性,并将其添加到第二个行组中:

代码语言:javascript
复制
            <TableRowGroup flowdoc:Attached.IsItemsHost="True">

            <!-- ITEMS PRESENTER -->

            </TableRowGroup>
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5159026

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档