0

I have a window named InstallerView and wish to display its contents within another window via ContentControl. What is the correct syntax as currently this doesnt work?

<ContentControl Content="{StaticResource ResourceKey=InstallerView}" Grid.Column="0" Grid.Row="1" Height="430" />

The window is defined as such

<Window x:Class="MyBootstrapper.InstallerView" .... >
4

1 回答 1

0

那么InstallerView不是你的窗口的名字,而是你的班级的名字。因此,您可以执行以下操作,尽管我不建议这样做。

<Grid> <!-- I need a layout control -->
    <Grid.Resources>
        <someNs:InstallerView x:Key="IView" /> 
        <!-- someNs = the namespace of your InstallerView class -->
    </Grid.Resources>
    <!-- Now you can use the resource -->
    <ContentControl Content="{StaticResource IView}" />
</Grid>
于 2013-03-19T14:03:49.660 回答