XAML WPF如何拉伸框架来填充窗口

时间:2017-10-27 10:28:58

标签: c# wpf xaml

标题非常具有描述性。 我有一个页面的框架,我想拉伸以填充窗口。 如果有人能让我对我应该做的事情有所了解,我会感激不尽。 这是我的XAML代码:

<Page x:Class="testWPF.CameraPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:controls="clr-namespace:LightBuzz.Vitruvius.Controls;assembly=LightBuzz.Vitruvius"
      mc:Ignorable="d" 
      Height="1920" Width="1080"
      d:DesignHeight="1920" d:DesignWidth="1080"
      Title="Camera"
      Unloaded="Page_Unloaded">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <controls:KinectViewer HorizontalAlignment="Stretch" x:Name="viewer" VerticalAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"/>
        <Frame HorizontalAlignment="Stretch" VerticalAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Name="frame2" NavigationUIVisibility="Hidden"/>
    </Grid>
</Page>

1 个答案:

答案 0 :(得分:0)

Grid.RowSpan="2"添加到Frame

<Frame Grid.RowSpan="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Name="frame2" NavigationUIVisibility="Hidden"/>