UWP CoreApplication/Application Vs CoreApplicationView/ApplicationView Vs CoreWindow/Window

栏目: 编程工具 · 发布时间: 7年前

内容简介:I find a question on Stack OverflowThis post is written in

I find a question on Stack Overflow CoreApplicationView vs CoreWindow vs ApplicationView , so I write this post for the answer.

This post is written in multiple languages . Please select yours:

The namespace

Sometimes we have to view the full class names with namespaces to determine their meanings.

Windows.ApplicationModel.Core.CoreApplication
Windows.ApplicationModel.Core.CoreApplicationView
Windows.UI.Xaml.Application
Windows.UI.Core.CoreWindow
Windows.UI.Xaml.Window

Extra, if you’re interested in the titlebar,

Windows.ApplicationModel.Core.CoreApplicationViewTitleBar
Windows.UI.ViewManagement.ApplicationViewTitleBar

Extra, if you’re interested in the threading model,

Windows.UI.Core.CoreDispatcher
Windows.UI.Xaml.DispatcherTimer

We can split them into Windows.ApplicationModel and Windows.UI , or split them into Core and Xaml .

The CoreApplication and CoreApplicationView manage the application model, and the Application , CoreWindow and Window manage the application inner UI. The CoreApplication , CoreApplicationView and CoreWindow manages the core functions, but the Application and Window manage the XAML UI.

From top to bottom

From top to bottom is from Application to Window , then to XAML. It’s obvious that the application contains windows and the window contains the inner XAML UI. Then, what’s the real relationship?

The CoreApplication manages all the views of a UWP application and the CoreApplicationView is the view that it manages directly. A CoreApplicationView contains a CoreWindow as the window and a CoreDispatcher as the threading model.

UWP CoreApplication/Application Vs CoreApplicationView/ApplicationView Vs CoreWindow/Window ▲ UWP application view

You can read Show multiple views for an app - UWP app developer - Microsoft Docs to learn how to write multiple views applications. You’ll know more about the relationship between the CoreApplication and the CoreApplicationView .

CoreWindow is the window that we are all familiar with. Windows.UI.XAML.Window encapsulate the CoreWindow for easier usage. CoreDispatcher is the threading model based on the windows message loop. It’s the CoreDispatcher that keeps the window to show all the time without being disposed.

For outer or for inner

Most UWP developers are normal developers, so we should stand on their side to think about the outer and the inner. Normal UWP developers start writing code from MainPage , so the outer is out of the page and the inner is the XAML content of the page.

The outer part contains CoreApplication , CoreApplicationView and CoreWindow while the inner part contains Application and Window . Is it strange that the Application and the Window are the inner part? The reason is that they manage the XAML part of the application and the window.

The Window is the encapsulation of the CoreWindow to provide extra XAML UI functions. The same to the ApplicationView , it is the encapsulation of the CoreApplication providing extra XAML UI functions.

In details, the CoreWindow is the class that interop with the Windows Operating System and the UWP application model. It provides those functions such as the window size, location, the input status, etc. The Window is the class that provides the ability to use XAML UI for the window, such as setting the XAML content of the window, setting the titlebar of the window, or getting the Compositor of the window. The CoreApplicationView is the class that interop with the Windows Operating System and provides the mechanism of windows message loop and the ability to change the client area and the non-client area. The ApplicationView is the same as the Window , provides the ability to use XAML UI for the application.

In conclusion, the CoreWindow and the CoreApplicationView provide the low-level core functions of the operating system and the application model. The Window and the ApplicationView encapsulates them for XAML usage.

Some usages of these concepts

I’ve written some other posts about UWP that take advantages of these concepts. Unfortunately, they are all not in English.

References

本文会经常更新,请阅读原文: https://walterlv.github.io/post/core-application-window-of-uwp-en.html ,以避免陈旧错误知识的误导,同时有更好的阅读体验。

UWP CoreApplication/Application Vs CoreApplicationView/ApplicationView Vs CoreWindow/Window 本作品采用 知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议 进行许可。欢迎转载、使用、重新发布,但务必保留文章署名 吕毅 (包含链接: https://walterlv.github.io ),不得用于商业目的,基于本文修改后的作品务必以相同的许可发布。如有任何疑问,请 与我联系


以上所述就是小编给大家介绍的《UWP CoreApplication/Application Vs CoreApplicationView/ApplicationView Vs CoreWindow/Window》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

天涯虚拟社区

天涯虚拟社区

刘华芹 / 民族出版社 / 2005-11 / 23.00元

网络空间很复杂,好多人并不完全了解或者只是了解到一些皮毛。比如说好多人对于见网友一事总是抱着浪漫或者暖昧的想法,而事实却并不总是想象的那样。作者在做虚拟社区研究甚至是在有这个想法之前并不常呆在网上,互联网对于作者来说就是查查资料、收发信年、看看新闻的工具。担是看着越来越多的人把时间花在网上,一处文化上的直觉告诉作者:有一种新的生活方式产生了。强烈的好奇心驱使着作者走到了网上,走到了天涯虚拟社区,并......一起来看看 《天涯虚拟社区》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

SHA 加密
SHA 加密

SHA 加密工具

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具