【问题标题】:Xamarin forms UWP fixed widthXamarin 形成 UWP 固定宽度
【发布时间】:2019-07-20 11:40:49
【问题描述】:

在 Windows 环境中运行时,可以调整 Xamarin Forms UWP 应用的大小(与始终全屏的平板电脑环境相比)。

有没有办法设置窗口的最小宽度?页面上的 MinimumWidthRequest 似乎没有完成这项工作。默认情况下,应用的宽度不会低于 500 像素(不确定该设置的来源),但我希望该值为 1000 像素。

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:SampleApp"
             MinimumWidthRequest="1000"
             x:Class="SampleApp.MainPage">

    <StackLayout>
        <!-- Place new controls here -->
        <Label Text="Welcome to Xamarin.Forms!" 
           HorizontalOptions="Center"
           VerticalOptions="CenterAndExpand" />
    </StackLayout>

</ContentPage>

【问题讨论】:

    标签: xamarin xamarin.forms


    【解决方案1】:

    你需要在页面渲染器上做

    OnElementChanged 内添加这个。

    ApplicationView.PreferredLaunchViewSize = new Size(1000, 1000);
    ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize;
    

    Reference

    【讨论】:

      猜你喜欢
      • 2021-11-28
      • 2018-06-27
      • 2016-08-28
      • 2017-01-04
      • 2019-03-29
      • 2020-07-13
      • 1970-01-01
      • 1970-01-01
      • 2020-08-30
      相关资源
      最近更新 更多