0

Is it possible to have a already created FixedPage from a FixedDocument and add it to a WPF Window like you would add a UserControl?

The purpose is basically add page to a Grid and wrap borders, headers, and/or footers to the page to create a new fixed page.

Was trying something like this but it did not work:

    <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>
Tommy
  • 71
  • 4
  • Sorry I think you misunderstood my question. I understand datatemplates and triggers and I think that part is fine. I was trying to figure out if I have a "FixedPage"/"PageContent" object in my view model, how can I insert that into a WPF Window/Grid XAML. The template seems to work just fine but that place the page would be shown is just blank. – Tommy Sep 17 '14 at 22:16
  • ah I see, I had a similar problem and solved it using a `Control`. You can use also a `ControlTemplate` to dynamically change the content of the `FixedPage` based on `Triggers`. Here is my [question](http://stackoverflow.com/questions/25844872/how-to-retrieve-visualchild-from-controltemplate). HTH BTW with your edit I'll remove my first comment as it will look like I haven't read your question. – XAMlMAX Sep 18 '14 at 19:35

0 Answers0