Questions tagged [community-toolkit-mvvm]
85 questions
14
votes
3 answers
Can't use ICommand attribute in view model using CommunityToolkit.Mvvm
In my view models, I wanted to use the source generators in CommunityToolkit.Mvvm but for some reason I can't seem to use [ICommand] attribute with my action methods.
The error I get is:
Cannot apply attribute class 'ICommand' because it is…

Sam
- 26,817
- 58
- 206
- 383
9
votes
6 answers
MAUI app not working in release mode but it works perfectly in debug mode
My MAUI App when running in Debug mode in a emulator is working good but it is not running when I run this in release mode ( does not work either in emulator or a physical device) it crashes.
I am using the Mvvm architecture using a library called…

Reyneer Leon
- 356
- 2
- 14
6
votes
2 answers
Call method when ObservableProperty changes using CommunityToolkit.Mvvm
I'm implementing auto complete feature in my .NET MAUI app and I'm using CommunityToolkit.Mvvm code generators in my view model to handle observable properties.
I have the following code and I'm trying call GetSuggestions() method when the…

Sam
- 26,817
- 58
- 206
- 383
3
votes
1 answer
MVVM: delegating PropertyChanged notifications A -> B (readonly) -> C
In a .NET MAUI application I am using the Mvvm.CommunityToolkit with source generation capabiliities for INotifyPropertyChanged support in my…

Hottemax
- 305
- 1
- 12
2
votes
1 answer
CollectionView's selected item and another control bound to the same property behave incorrectly
In .Net MAUI app, I have a label's text and CollectionView's selected item bound to the same property. So I expect upon selecting an item in the CollectionView, a corresponding text to appear in the label, and the selected item to change color in…

David Shochet
- 5,035
- 11
- 57
- 105
2
votes
1 answer
Showing ObservableCollection item changes using CommunityToolkit.Mvvm in .NET MAUI
I went through SO questions on this topic and thought I followed the examples carefully but I still don't see a UI update when a property of an item in a CollectionView gets updated.
First, I made sure the property in my model is decorated with…

Sam
- 26,817
- 58
- 206
- 383
2
votes
1 answer
NotifyPropertyChangedFor not working on ObservableObject
I'm a little lost right now. I'm using the CommunityToolkit.Mvvm for MVVM in a small application.
My UI consists of some settings and some parameters; I'm updating (performing calculations) once a property changes.
In this case I'd like to fire…

Vegetico
- 93
- 8
2
votes
2 answers
NotifyOfProperty change from inside of ObservableCollection
How can I trigger NotifyOfPropertyChange by changing property of item inside of ObservableCollection?
Currently I am assigning null to ObservableCollection and then the original value. However, I don't think this is a proper…

Filip Zaťko
- 33
- 1
- 1
- 6
2
votes
1 answer
VS2022 c# adds private modifier on file save
I want to use Microsoft MVVM Toolkit [ObservableProperty] attribute, it works fine, but in one case I need to use changed method:
[ObservableProperty]
private string? name;
partial void OnNameChanging(string? value)
{
Console.WriteLine($"Name…

Andreas_k
- 103
- 8
2
votes
2 answers
NET MAUI CommunityToolkit.Mvvm not validating
I have a view model:
public delegate void NotifyWithValidationMessages(Dictionary validationDictionary);
public partial class BaseViewModel : ObservableValidator
{
public event NotifyWithValidationMessages?…

Wasyster
- 2,279
- 4
- 26
- 58
2
votes
1 answer
Setting a property value using reflection throwing an exception
Im using the Microsoft Community MVVM package within my MAUI app. It's working well, but I've hit an issue.
Part of my UI modifies a structure which sends a message to the view model. This works fine. However, when I try to modify the structure, I'm…

Nodoid
- 1,449
- 3
- 24
- 42
2
votes
1 answer
Is there any other way of ignoring a property during JSON serialization instead of using [JsonIgnore] decorator?
I am using .net Maui MVVM source generators to create properties as observable properties. I am using System.Text.Json.Serialization to serialize the properties of a class to JSON. When I use [JsonIgnore] on some properties they still get serialized…

Saiteja Rangi
- 41
- 3
2
votes
1 answer
How to do binding based on a condition in .net maui?
I'd like to ask how to do the conditional binding in a .net Maui app. for example
if I have a class
public class ClassA
{
public string Property1{get;set;}
public string Property2{get;set;}
}
and I don't have access to the class…

Shehab
- 431
- 2
- 10
2
votes
2 answers
Proper way of displaying an ObservableGroupedCollection using Wpf .NET 6 and the CommunityToolkit.Mvvm Package
ObservableGroupedCollection in Wpf .NET 6
This question is based on:
A Wpf project using .NET 6
The ObservableGroupedCollection class from the NuGet package "CommunityToolkit.Mvvm" by Microsoft
striktly obeying the MVVM…

ge.go
- 65
- 1
- 10
2
votes
1 answer
How to send messages between threads using CommunityToolkit.Mvvm.Messaging and WinUI 3?
The following simple multi-threaded program was meant to try out the CommunityToolkit Messenger package for which the documentation says (see: Messenger)
Both WeakReferenceMessenger and StrongReferenceMessenger also expose a Default property that…

aturnbul
- 347
- 2
- 12