Jochem
✅ MAUI UI won't update after calling OnPropertyChanged from Command
Hey there, I am working on a MAUI application and came across a problem where the UI won't update after calling
OnPropertyChanged
I know for sure that function gets called because I tested that using a debugger and break points. I made a small test project that displays three buttons. Whenever a button is pressed, the color of the button should change from red to green. However this does not happen. I just can't seem to figure out why :(.
I've pasted the code for my view model and view below.4 replies
❔ MAUI Error when loading resources on loading page
I have a view that displays the
Cards
property as a CollectionView
. The view model is populating the hand
data member inside a asynchronous function. The problem is that with the code below, sometimes my program will crash on startup and sometimes it will not. When commenting out the single statement in my constructor, the program won't crash. I think there's something wrong with the way I load my resources. Is there a better approach for loading resources that are needed on a page load (using MVVM)?
The location where my IDE points me to when stopping the program.
2 replies
❔ HTTP request object creation / ignoring fields when deserializing JSON
Hey there. I am writing a program using the Deck of Cards API which can be found here: https://deckofcardsapi.com/. The API returns a response which contains JSON.
I have a class named "Deck", I first wanted "Deck" to load and deserialize itself in the constructor using the API but I don't really know if that's possible or a good idea. I am wondering if there are better alternatives or best practices for this problem.
I also have a second problem. Whenever I want to request a card using the API, the response contains many properties I don't need. Is there a way of only deserializing certain properties? Above you can see a class called "Card" and I only need "Value", "Suit", and "Image" but the JSON in the response contains much more as you can see below.
Response when drawing card(s).
31 replies