0

I'm developing a WPF application with the same grid layout for every page.

Since I don't want to rewrite it in every page, I was wondering if it is possible to declare the layout in a Resource Dictionary and include the dictionary in every page, in order to use the grid like this:

<Page ...
    >
    <Grid>
        <Grid.Resources>
            <ResourceDictionary>
                <ResourceDictionary.MergedDictionaries>
                    <ResourceDictionary Source="/Resources/Style.xaml" />
                </ResourceDictionary.MergedDictionaries>
            </ResourceDictionary>
        </Grid.Resources>
        <Button Name="ButtonReturn" Grid.Column="3" Grid.Row="1" >Click</Button>
    </Grid>
</Page>

Without having to specify the column layout again.

Is this possible?

Dennis
  • 37,026
  • 10
  • 82
  • 150
  • 1
    You can create `UserControl` (to contain repeated part) with `ContentControl` and bind custom `Page` content to it. – Sinatr May 20 '15 at 12:52
  • 1
    Since your question comes to "How to set Grid.RowDefinitions/Grid.ColumnDefinitions from style", I've marked it as a duplicate. – Dennis May 20 '15 at 12:56

0 Answers0