- Библиотека пользовательского интерфейса Windows 2.x Windows UI Library 2.x
- Возможности Features
- Примеры Examples
- Документация Documentation
- Установка и использование библиотеки пользовательского интерфейса Windows Install and use the Windows UI Library
- План разработки и открытый код Open source and developer roadmap
- Список пакетов NuGet NuGet package list
- User Interface Language Management
- Languages Maintained by the Operating System
- System Default UI Language/Install Language
- System UI Language
- User UI Language
- Language Lists Maintained by the Operating System
- System Preferred UI Languages List
- User Preferred UI Languages List
- Process Preferred UI Languages List
- Thread Preferred UI Languages List
- Neutral Language Representation
- Language Fallback in the Resource Loader
Библиотека пользовательского интерфейса Windows 2.x Windows UI Library 2.x
В библиотеке пользовательского интерфейса Windows предоставляются официальный набор элементов управления пользовательского интерфейса Windows и других элементов пользовательского интерфейса для приложений Windows. The Windows UI Library provides official native Windows UI controls and other user interface elements for Windows apps.
Она поддерживает совместимость низкого уровня с предыдущими версиями Windows 10, поэтому ваше приложение будет работать, даже если пользователи применяют не самую последнюю версию ОС. It maintains down-level compatibility with earlier versions of Windows 10, so your app works even if users don’t have the latest OS.
Ознакомьтесь с предварительной версией 4 библиотеки пользовательского интерфейса Windows 3 (февраль 2021 г.), крупным обновлением, связанным с платформой пользовательского интерфейса Windows 10. Check out the Windows UI Library 3 Preview 4 (February 2021), a major update to the Windows 10 UI platform.
Возможности Features
Новые элементы управления. Библиотека пользовательского интерфейса Windows содержит новые элементы управления, которые не предоставляются на платформе Windows по умолчанию. New controls: The Windows UI Library contains new controls that aren’t shipped as part of the default Windows platform.
Обновленные версии существующих элементов управления. Библиотека также содержит обновленные версии существующих элементов управления платформы Windows, которые можно использовать в более ранних версиях Windows 10. Updated versions of existing controls: The library also contains updated versions of existing Windows platform controls that you can use with earlier versions of Windows 10.
Поддержка более ранних версий Windows 10. API библиотеки пользовательского интерфейса Windows работают в предыдущих версиях Windows 10, поэтому для обеспечения работы пользователей, не использующих последние версии ОС, не нужно добавлять проверки версии или условный код XAML. Support for earlier versions of Windows 10: Windows UI Library APIs work on earlier versions of Windows 10, so you don’t have to include version checks or conditional XAML to support users who might not be running the very latest OS.
Поддержка XamlDirect. Интерфейсы API XAML Direct, предназначенные для разработчиков ПО промежуточного слоя, предоставляют доступ к функциям XAML более низкого уровня, которые обеспечивает более высокую производительность по нагрузке на ЦП и рабочему набору. Support for XamlDirect: The Xaml Direct APIs, designed for middleware developers, gives you access to a lower-level Xaml features which provide better CPU and working set performance. XamlDirect позволяет применять API XamlDirect в более ранних версиях Windows 10, не требуя писать специальный код для работы с несколькими целевыми версиями Windows 10. XamlDirect enables you to use XamlDirect APIs on earlier versions of Windows 10 without needing to write special code to handle multiple target Windows 10 versions.
Примеры Examples
Пример приложения XAML Controls Gallery включает интерактивные демонстрации и примеры кода для работы с элементами управления WinUI. The Xaml Controls Gallery sample app includes interactive demos and sample code for using WinUI controls.
Установите приложение XAML Controls Gallery из Microsoft Store. Install the XAML Controls Gallery app from the Microsoft Store
Также на сайте GitHub доступен открытый код приложения Xaml Controls Gallery. The Xaml Controls Gallery is also open source on GitHub
Документация Documentation
Практические руководства по элементам управления из библиотеки пользовательского интерфейса Windows вы найдете в документации по элементам управления универсальной платформы Windows. How-to articles for Windows UI Library controls are included with the Universal Windows Platform controls documentation.
Справочная документация по API доступна по этой ссылке: API библиотеки пользовательского интерфейса Windows. API reference docs are located here: Windows UI Library APIs.
Установка и использование библиотеки пользовательского интерфейса Windows Install and use the Windows UI Library
План разработки и открытый код Open source and developer roadmap
WinUI — проект с открытым кодом, размещенный на сайте GitHub. WinUI is an open source project hosted on GitHub. Мы рады любым сообщениям об ошибках, запросам на добавление функций и вкладам сообщества в создание кода, вносимым в репозиторий библиотеки пользовательского интерфейса Windows. We welcome bug reports, feature requests and community code contributions in the Windows UI Library repo.
Мы продолжаем разрабатывать и развивать WinUI, чтобы поддерживать новые сценарии разработки. We are continuing to develop and evolve WinUI to support more developer scenarios. Последние сведения о планах по разработке Windows см. в этой статье о стратегии развития, размещенной в репозитории библиотеки пользовательского интерфейса Windows. For the latest details about our plans for WinUI, see our roadmap on the Windows UI Library repo.
Список пакетов NuGet NuGet package list
Библиотека пользовательского интерфейса Windows содержит несколько пакетов NuGet: Список пакетов NuGet для библиотеки пользовательского интерфейса Windows. The Windows UI Library contains multiple NuGet packages: Windows UI Library NuGet package list.
User Interface Language Management
MUI allows your applications to manage user interface languages in two ways. An application can use a simple approach to language management by defaulting to the operating system language settings. Alternatively, the application can support its own languages from which the user can select. The MUI API also allows your application direct access to languages and language lists supported by the operating system and maintained by the resource loader. The remainder of this topic defines the system-supported languages and the language fallback mechanism.
Languages Maintained by the Operating System
System Default UI Language/Install Language
The system default UI language is the language of the localized version used to set up Windows. All menus, dialog boxes, error messages, and help files are represented in this language, except when the user selects a different language.
On WindowsВ Vista and later, the system default UI language is known as the «install language» and plays a more limited role. For most purposes, it is superseded by the system preferred UI languages. However, in certain contexts it is useful to have a single install language that is always known to be fully supported.
No MUI function is available to set the system default UI language. To retrieve this language, the application can call GetSystemDefaultUILanguage.
System UI Language
The operating system defines the system UI language as a user interface language that can be set by an administrator in the Advanced tab of the regional and language options portion of Control Panel. The operating system uses this language if the current user has not made specific language settings or if no active account is logged in. The language can be changed only if more than one user interface language is installed on the computer.
The operating system must be rebooted for all users and services to see the effect of the language change.
No MUI function is available to set the system UI language. To retrieve this value, an application targeted at WindowsВ Vista and later can call GetSystemPreferredUILanguages and obtain the first language in the system preferred UI languages list. Applications targeted at pre-WindowsВ Vista operating systems cannot use GetSystemPreferredUILanguages and should be based on the assumption that the system UI language is always the same as the system default UI language.
User UI Language
The user UI language determines the user interface language used for menus, dialog boxes, help files, and so forth. It can be set by the current user in the Language tab of the regional and language options portion of Control Panel. This language can be changed only if more than one user interface language is installed on the computer. Note that the user will have to log off and then log back on to see the effect. For example, a multinational corporation wants to deploy Windows in all of its subsidiaries. The company creates a global install job, which installs the English language version of Windows on all clients, regardless of location. At the same time, it installs specific language modules depending on the organizational unit of which a computer is a member. When the user logs on the first time to a newly installed operating system, Windows appears as a localized version.
On WindowsВ Vista and later, the user UI language is the first language in the user preferred UI languages list. Note that fallback languages can be used if particular resources are not available in this language.
On pre-WindowsВ Vista operating systems, the user UI language is usually the same as the system default UI language. However, for Windows MUI, the two languages can be different.
To retrieve the user UI language, an application can call GetUserDefaultUILanguage or GetUserPreferredUILanguages. The application cannot change the user UI language, as there is no function to set it.
Language Lists Maintained by the Operating System
System Preferred UI Languages List
The resource loader maintains a system preferred UI languages list. Included in this list are languages preferred by the operating system for its own resources, such as menus and dialogs, messages, INF files, and help files. The list is made up of the system default UI language and the system UI language and their fallbacks. An application can retrieve system preferred UI languages by calling GetSystemPreferredUILanguages.
User Preferred UI Languages List
The resource loader uses a user preferred UI languages list that includes languages that the user prefers. The resource loader uses resources matching languages from this list, if available, for a particular application thread. These languages take precedence over any system preferences. To retrieve user preferred UI languages, your application can call GetUserPreferredUILanguages.
Process Preferred UI Languages List
On WindowsВ Vista and later, the resource loader maintains a process preferred UI languages list consisting of up to five valid languages set by a running process for a MUI application. The languages can be set by the application with a call to SetProcessPreferredUILanguages. The application can retrieve the languages by calling GetProcessPreferredUILanguages.
Thread Preferred UI Languages List
On WindowsВ Vista and later, the resource loader uses a thread preferred UI languages list that consists of up to five valid languages set by a thread in a running process for a MUI application. These languages are used to customize the application user interface languages and make them different from the operating system language. The thread preferred UI languages list is based on the user preferred UI languages, the system preferred UI languages, and the system default UI language.
To set the thread preferred UI languages, the application should call SetThreadPreferredUILanguages. To retrieve these languages, the application calls GetThreadPreferredUILanguages.
Neutral Language Representation
A neutral language is represented as the language alone, without region or locale. For example, the neutral representation of the English (Canada) language, en-CA, is represented as «en». Even though a neutral language is not associated with the aspects of a region or locale, you can associate it with a resource set. Typically, a neutral language resource is based on the use in the most prevalent region for the language.
As an illustration, suppose that your MUI application localizes German language resources for German (Switzerland) represented as de-CH and German (Austria) represented as de-AT, while building a full set of resources for German (Germany) represented as de-DE. You must make decisions for this application considering entire resource files. If the application duplicates the de-DE resources as neutral language resources, it must provide a fallback language for the resource loader. If the loader does not find a particular language-specific resource file for de-CH or for de-AT, it falls back to the language-neutral «de» resources. These resources are most likely more appropriate than resources for a completely different language, for example, English (United States), which are the only other possible fallbacks.
As another example, an application might not localize at all for Belize. However, support of a language preference of English (Belize), represented as en-BZ, allows the application to fall back to «en» resources.
Language Fallback in the Resource Loader
WindowsВ Vista and later arrange user interface language settings in a preordered fallback language list used by the resource loader. To form the list, the operating system combines several languages, in the order shown:
Thread preferred UI languages, consisting of thread user interface language and its neutral form. Examples are fr-FR for French (France) and its neutral form «fr» and es-ES for Spanish (Spain) and its neutral form «es».
Process preferred UI languages, consisting of process user interface language and its neutral form. An example is de-DE for German (Germany) and its neutral form «de».
User UI language and its neutral form. An example is ja-JP for Japanese (Japan) and its neutral form «ja».
System UI language and its neutral form. An example is it-IT for Italian (Italy) and its neutral form «it».
This language is only included in the fallback list when the user UI language is not set.
System default UI language and its neutral form. An example is es-ES for Spanish (Spain) and its neutral form «es».
The following shows the merged fallback list. Note that the duplication of languages, for example, es-ES and es, is eliminated. Since the example sets the user UI language to ja-JP, the system UI language does not appear in the merged fallback list.
fr-FR, fr, es-ES, es, de-DE, de, ja-JP, ja
When loading resources for a MUI application, the resource loader tries to select one of the files matching the thread preferred UI languages list for the currently running application thread. If the resource loader cannot find a direct match between a selected language and the first language-specific resource in the merged fallback list, it checks the subsequent languages in the list until it finds an acceptable fallback.
If the resource loader finds no file that it needs, it must use a «guaranteed good» fallback language. For the MUI resource technology, the resource loader determines the fallback language from the provided resource configuration data. For more information, see MUI Resource Management.