-
Notifications
You must be signed in to change notification settings - Fork 660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: Where are the standard UWP Controls ? #1670
Comments
The way WinUI 2.x functions is the following: Windows has some build in controls (such as buttons, textblock,...) whose behavior and "logic" comes from the operating system. However the template of those controls can be overridden, by defining a new template in the App.xaml. When installing the WinUI nuget package, you need to add the following lines to the App.xaml <ResourceDictionary.MergedDictionaries>
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls"/>
</ResourceDictionary.MergedDictionaries> By adding this line to your App.xaml file, you tell the xaml compiler to use any template it finds in that dictionary and use that instead of the standard templates. What WinUI does, is just override the templates for the already defined controls. Since the underlaying type is still a windows object, WinUI does not ship new types for those controls. Controls that are introduced with WinUI such as the new NumberBox are defined by WinUI and thus live in the Microsoft.UI.Xaml.Controls namespace. With WinUI 3.0 this will change, as all controls will be defined in Microsoft.UI.Xaml.Controls. TL;DR: Controls prior to WinUI are windows types where WinUI overrides the template, that is why you can't find them in the Microsoft.UI.Xaml.Controls namespace. |
Thanks a lot for that clarification. This means therefore that an app that target version 2.x will need to be refactored for 3.x as you will be using controls from the wrong namespace. |
Yes, unfortunately you will need to refactor your app. However, this should mostly only result in just changing "Windows.UI.Xaml.Controls" to "Microsoft.UI.Xaml.Controls". With the release of the WinUI 3.0 Alpha, the XAML Controls Gallery was also "ported" to WinUI 3.0 Alpha. While the Alpha does fall short on some areas, a lot was already implemented. If you want to check out what had to be changed, you might want to look at this pull request. In summary, most changes are changing "Windows.UI.Xaml.Controls" to "Microsoft.UI.Xaml.Controls" and getting rid of some API contracts, since WinUI 3.0 will (as far as I know) not rely heavily on Windows 10 SDK features, but rather ship them inside the nuget package. |
OK, Im still confused.
Im just trying to get to the bottom of what we have or dont have in terms on Winui (current version and v3) Thanks Dean |
I think the first goal of WinUI 3.0 (and the alpha) is to port existing types from build in windows controls into the WinUI repository and nuget package. After that a lot of improvements can be made, however getting there is probably difficult. Regarding your questions:
|
As @chingucoding said, currently, WinUI 3.0 Alpha is still developed in private. The WinUI team stated though that it is hard at work at open-sourcing the development of WinUI 3.0 so you can expect the source to be made publicly available before the release of WinUI 3.0. The team will perhaps announce more information in one of their upcomming Community Calls, you might want to check out the next one which is scheduled for this wednesday! |
@chingucoding - thanks for the reply, I really appreciate it. Regarding point 2 - if you look at the source for the XAML Control Gallery (Winui3alpha branch) you will see that, for example, the 'Button' demo page references the standard UWP button rather than any button included in the winui package. This is the same for all of the controls that already belong inside UWP - they are referencing the baked-in versions still. I assumed that the Winui v3 (alpha) was going to have brand new controls to replace the baked in UWP controls, but the XAML Control Gallery doesn't reflect this. Hopefully you can help clarify Thanks Dean |
@Felix-Dev - thanks very much for the clarificatio Dean |
Yes, they do not explicitly declare that those are WinUI controls. If you look at the generated files (e.g. ButtonPage.g.cs) you can see that those are all controls from Microsoft.UI.Xaml.Controls. WinUI 3.0 automatically overwrites the Windows SDK's controls , so the XAML compiler will choose the WinUI controls instead of the Windows SDK. |
@chingucoding - Ahhhhh, that makes complete sense. Thanks so much for that insight. Dean |
Happy I could help you :) |
On the WinUI page https://docs.microsoft.com/en-us/uwp/toolkits/winui/ we have this statement
The library also contains updated versions of existing Windows platform controls that you can use with earlier versions of Windows 10.
But when I add the xaml namespace xmlns:controls="using:Microsoft.UI.Xaml.Controls" to my project, the namespace doesnt include standard controls like 'button' or 'checkbox' etc.
Have I confused myself ? how do I get to the WinUI version of a checkbox (for example) rather than the build in version.
Thanks
Dean
The text was updated successfully, but these errors were encountered: