Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
是否可以将FixedPage添加到WPF窗口?_Wpf_Fixeddocument_Fixedpage - Fatal编程技术网

是否可以将FixedPage添加到WPF窗口?

是否可以将FixedPage添加到WPF窗口?,wpf,fixeddocument,fixedpage,Wpf,Fixeddocument,Fixedpage,是否可以从FixedDocument创建一个已创建的FixedPage,并将其添加到WPF窗口,就像添加UserControl一样 其目的基本上是将页面添加到网格中,并将边框、页眉和/或页脚包装到页面中以创建新的固定页面 我尝试过这样的事情,但没有成功: <ContentControl Content="{Binding}" Grid.Row="1"> <ContentControl.Resources> <DataT

是否可以从FixedDocument创建一个已创建的FixedPage,并将其添加到WPF窗口,就像添加UserControl一样

其目的基本上是将页面添加到网格中,并将边框、页眉和/或页脚包装到页面中以创建新的固定页面

我尝试过这样的事情,但没有成功:

    <ContentControl Content="{Binding}" Grid.Row="1">
        <ContentControl.Resources>
            <DataTemplate DataType="{x:Type local:CustomerReportPageViewModel}">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <local:CustomerReportGridHeader Grid.Row="0" />
                    <local:ReportItemsControl ItemsSource="{Binding DataDisplay}" Grid.Row="1" />
                </Grid>
            </DataTemplate>
            <DataTemplate DataType="{x:Type local:AppendixAReportPageViewModel}">
                <FixedPage DataContext="{Binding Content}" />
            </DataTemplate>
        </ContentControl.Resources>
    </ContentControl>

对不起,我想你误解了我的问题。我了解数据模板和触发器,我认为这一部分很好。我试图弄清楚我的视图模型中是否有一个FixedPage/PageContent对象,如何将其插入到WPF窗口/网格XAML中。模板似乎工作得很好,但页面显示的位置是空白的。啊,我明白了,我遇到了类似的问题,并使用控件解决了它。您还可以使用ControlTemplate根据触发器动态更改FixedPage的内容。这是我的名片。顺便说一句,通过你的编辑,我将删除我的第一条评论,因为它看起来好像我还没有读过你的问题。