2 回答

TA貢獻(xiàn)1824條經(jīng)驗(yàn) 獲得超5個(gè)贊
如果您明確設(shè)置頁面的寬度,它將永遠(yuǎn)不會(huì)拉伸:
刪除Width="600",或者您可以設(shè)置MinWidth="600"。
<Page
x:Class="Stupendous_Styles_Challenge.Donuts"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Stupendous_Styles_Challenge"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" MinWidth="600">
<Page.Resources>
<Style TargetType="TextBlock" x:Key="myTextBlockStyle">
<Setter Property="FontSize" Value="24" />
<Setter Property="Margin" Value="10, 0, 0, 0" />
</Style>

TA貢獻(xiàn)1811條經(jīng)驗(yàn) 獲得超6個(gè)贊
我認(rèn)為這可能會(huì)解決問題,這是 donuts.xaml 的編輯版本:
<Page
x:Class="Stupendous_Styles_Challenge.Donuts"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Stupendous_Styles_Challenge"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" Width="600">
<Page.Resources>
<Style TargetType="TextBlock" x:Key="myTextBlockStyle">
<Setter Property="FontSize" Value="24" />
<Setter Property="Margin" Value="10, 0, 0, 0" />
</Style>
<Style TargetType="Slider" x:Key="mySliderStyle">
<Setter Property="Width" Value="200" />
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Maximum" Value="24" />
<Setter Property="Minimum" Value="0" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
</Style>
</Page.Resources>
<Grid Background="Red" HorizontalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="200"/>
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Image Source="Assets/white-logo.png" Height="200" Width="200" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Original Glazed Count: " Style="{StaticResource myTextBlockStyle}"/>
<Slider Grid.Column="1" Style="{StaticResource mySliderStyle}" />
<TextBlock Grid.Row="1" Text="Speedway Special Count: " Style="{StaticResource myTextBlockStyle}" />
<Slider Grid.Column="1" Grid.Row="1" Style="{StaticResource mySliderStyle}" />
</Grid>
</Grid>
在
<Grid Background="Red" HorizontalAlignment="Stretch">
部分:
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
我認(rèn)為問題在于框架內(nèi)的網(wǎng)格沒有占用它可以獲得的空間并且具有固定的寬度,添加了 columndefinition 它確實(shí)占用了它所能占用的所有空間。
- 2 回答
- 0 關(guān)注
- 185 瀏覽
添加回答
舉報(bào)