-
Notifications
You must be signed in to change notification settings - Fork 32
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
ICommand and other Inteface differences bewteen UWP and WinUI #10
Comments
@GuildOfCalamity Yes, in Chapter 4 was when I almost quit reading the book because the project will not compile anymore (and the project templates in the book did not match the ones on VS 2019, and the same with the NuGet packages). Then the same issue in another Chapter. At the end I finished the book with all the code working. |
@jvsca That would be great if you could! I made it pretty far using the Nugets you recommended but the Interfaces are killing me. You bring up a good point about the templates. I'm hoping Alvin will update all the source code and branch it to represent the changes that have occurred with WinUI, a.k.a. Project Reunion, a.k.a. WindowsAppSDK. |
@jvsca Thanks! I found that I could only get yours to build after adding the suggested references... I'm not sure what your references normally look like, this maybe just a difference with our respective local Nuget caches. |
@GuildOfCalamity I always clean the solution. The reference are almost the same: |
Thanks for all the feedback, folks. I know it's difficult to work with this stuff when it keeps changing. I think I will create a branch once the Windows App SDK 1.0 release is out (hopefully that is very soon!). With the recent news about UWP not coming to .NET 5/6, what do you all think I should do about the WinUI in UWP projects in the new branch? Should they get switched to WinUI Desktop projects, so they'll all work with the v1 SDK? |
Thanks Alvin! |
Thanks Alvin. |
@jvsca I had to stop reading the book and trying the samples because nothing worked (I can't believe you stuck with it until the end, bravo!). I've been trying to just use the default UWP packages and following the samples on Microsoft's github. |
I'm going through the book trying the progressive samples as a .NET 6 WinUI Desktop project. Stuck at the beginning of Ch. 4 with a 'ViewModel property cannot be null' runtime hang up. |
Do you know from the error which property is having an issue? I haven't seen that kind of error before. Usually nulls are handled by xaml unless there's a custom converter that isn't checking for null. Can you modify the getter of the property to return another non-null default value when it is null? |
Here's the line it stalls on: |
(Application.Current as App).Container = null |
Is the code to initialize the Container in App.xaml.cs in place? Make sure The RegisterServices() method is there, and it's being called what the app is launched. In the example code, it's called at the beginning of App.OnLaunched(). |
Brilliant! Moved 'Container = RegisterServices();' to the beginning of OnLaunched, before the MainWindow activates. We're back in business now. Thanks for the prompt response, Alvin. Happy New Year. |
That's great! I'm happy to hear that resolved the problem. Good luck with the rest and happy new year to you too! |
While working through Ch04, found the following issue with NavigationService.cs: Line 19 - private static Frame AppFrame => (Frame)Window.Current.Content; (Frame)Window.Current = null |
It looks like there are some differences here between the UWP and Desktop WinUI projects. Take a look at this discussion about making this call on a UI thread in a desktop project. microsoft/microsoft-ui-xaml#2609 |
I was wondering if anyone else was trying this:
I was going to see how far I could get in the book by using the built-in blank UWP template in VS2019.
When setting up a blank UWP project, it seems some of the interfaces aren't compatible.
Specifically the ICommand interface in the RelayCommand class.
I've changed "using Microsoft.UI.Xaml.Input;" to "using System.Windows.Input;" to see if that will work.
Same thing with the Microsoft.UI.Xaml.Interop.NotifyCollectionChangedAction, but I cannot find a replacement besides using System.Collections.Specialized
Is anyone else trying these projects using standard UWP, or is it impossible because of these specialized interfaces and the WinUI library?
@jvsca if you're out there, did you ever make it past chapter 4?
The text was updated successfully, but these errors were encountered: