[UWP]自定义UWP-App,如“Skype for Business” (Surface Hub) [英] [UWP]Custom UWP-App like "Skype for Business" (Surface Hub)

查看:86
本文介绍了[UWP]自定义UWP-App,如“Skype for Business” (Surface Hub)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我正在为Surface Hub开发一个UWP-App我不希望用户调整此应用程序的大小。就像"Skype for Business"一样应用程序,它以固定大小启动
,并且不能更改宽度。

现在我想知道,是否可能有相同的
行为 在我的自定义UWP-App中。

Now I was wondering, if it' possible to have the same behavior in my custom UWP-App.

非常感谢提前和b est问候。

推荐答案

嗨  Sudlon,

Hi Sudlon,

欢迎来到
开发Uni versal Windows apps论坛
!请使用  标记 
发布到这个论坛时,谢谢!

正如我所看到的,Skype for Business仍然可以调整大小,直到最小尺寸。如果你想要你的应用程序是固定大小,你可以尝试以下解决方法,但应用程序窗口将闪烁。你可以参考它。

As what I can see, the Skype for Business still could be resized until a minimum size. If you want your app in a fixed size, you can try the following workaround but app window will flicker. You can reference it.

首先,你可以添加以下代码在App.xaml.cs中的OnLaunched方法中,

Firstly, you can add the following code in the OnLaunched method in the App.xaml.cs,

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

之后,您可以注册
SizeChanged
事件(例如MainPage.xaml.cs)和调整视图大小,

After that, you can register the SizeChanged event in the Page.xaml.cs (such as MainPage.xaml.cs) and Resize the view,

        public MainPage()
        {
            this.InitializeComponent();
            Window.Current.CoreWindow.SizeChanged += CoreWindow_SizeChanged;
        }

        private void CoreWindow_SizeChanged(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.WindowSizeChangedEventArgs args)
        {
            var result = ApplicationView.GetForCurrentView().TryResizeView(new Size(600, 400));
        }

祝你好运,

Breeze


这篇关于[UWP]自定义UWP-App,如“Skype for Business” (Surface Hub)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆