0
我的Windows 8桌面應用程序中有以下數據模板。比例高度XAML中的網格
<DataTemplate x:Key="Standard250x480ItemTemplate">
<Grid HorizontalAlignment="Left" Width="250" Height="480" Margin="0 0 0 0">
<!--<Border Background="{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}">-->
<Border Background="#ffffff">
<Image Source="{Binding Image}" Stretch="Uniform" AutomationProperties.Name="{Binding Title}" />
</Border>
<StackPanel VerticalAlignment="Bottom" Background="{StaticResource ListViewItemOverlayBackgroundThemeBrush}">
<TextBlock TextAlignment="Center" Padding="0 18 0 0" FontSize="25" Text="{Binding Title}" Foreground="{StaticResource ListViewItemOverlayForegroundThemeBrush}" Style="{StaticResource TitleTextStyle}" Height="60" Margin="15,0,15,0" />
<!--<TextBlock Text="{Binding Subtitle}" Foreground="{StaticResource ListViewItemOverlaySecondaryForegroundThemeBrush}" Style="{StaticResource CaptionTextStyle}" TextWrapping="NoWrap" Margin="15,0,15,10"/>-->
</StackPanel>
</Grid>
</DataTemplate>
網格高度爲480像素,並thsi行之有效的一些畫面,但在電網的id內容在較小的屏幕切斷。
如何使網格高度按比例縮放以適合屏幕尺寸,以便網格的所有內容都適合屏幕。
數據模板駐留在定義了4行的XAML頁面上。數據模板位於第3行,即Grid.Row="2"
。
<Grid Style="{StaticResource LayoutRootStyle}">
<Grid.RowDefinitions>
<RowDefinition Height="140"/>
<RowDefinition Height="130"/>
<RowDefinition Height="*"/>
<RowDefinition Height="110"/>
</Grid.RowDefinitions>
</Grid>
我已經嘗試設置最小和最大高度,但它似乎沒有工作。
我該如何解決這個問題?