您可以通过在应用的 OnLaunched 方法中使用 SetPreferredMinSize 来缩小窗口。
这是一个例子
protected override async void OnLaunched(LaunchActivatedEventArgs e)
{
...
var applicationView = ApplicationView.GetForCurrentView();
applicationView.SetPreferredMinSize(new Size { Width = 202, Height = 357 });
Window.Current.Activate();
}
允许的最小尺寸为 192x48 EP(有效像素)。 See here for more information.
就 SplitView.Content 区域而言,我检查了模板,除了窗格的 ColumnDefinition 之外,没有看到任何会限制其最小尺寸的东西
这是提取的 SplitView 模板中的 sn-p:
<Grid.ColumnDefinitions>
<ColumnDefinition x:Name="ColumnDefinition1"
Width="{Binding TemplateSettings.OpenPaneGridLength, FallbackValue=0, RelativeSource={RelativeSource Mode=TemplatedParent}}" />
<ColumnDefinition x:Name="ColumnDefinition2"
Width="*" />
</Grid.ColumnDefinitions>
我注意到ColumnDefinition1 正在使用绑定TemplateSettings.OpenPaneLength,在测试OpenPaneLength="0" 之后它似乎尊重内容。
这是我在将 OpenPaneLength 设置为 0 后使用您的 GitHub 存储库得到的调试输出
Page Width: 202 and Height: 464
ContentFrame Width: 202 and Height: 464
Smallest there is.