Questions tagged [community-toolkit-mvvm]
85 questions
2
votes
0 answers
.Net Maui Bind ViewModel properties of Custom Control
I ran into a problem by creating a reusable custom control with the CommunityToolkit.Mvvm package.
I have a page like this:

dominikz
- 45
- 5
2
votes
2 answers
How to initialize ViewModel with CommunityToolkit.Mvvm
We have a Xamarin.Forms app with FreshMvvm. Now, as Xamarin.Forms will not get support beginning next year, I am re-writing the app with .Net Maui. For MVVM pattern, I am trying to use CommunityToolkit.Mvvm. But I wonder how I can initialize the…

David Shochet
- 5,035
- 11
- 57
- 105
2
votes
0 answers
CanExecute Not working CommunityToolkit.Mvvm -Version 8.0.0-preview4
Why the CanExecute property for RelayCommandAttribute Not working in CommunityToolkit.Mvvm -Version 8.0.0-preview4
ex :
this will work
public bool CanDo(string x) => true;
[RelayCommand(CanExecute=nameof(CanDo))]]
public void DoSomthing(string…

Nadir Mezhoudi
- 155
- 2
- 13
1
vote
1 answer
Explicit viewmodel instantiation from constructor
Is there anything semantically different in, or inherently wrong with, instantiating a viewmodel explicitly from a page's constructor, opposed to declaring it from within XAML using a property element?
NotePage.xaml
…

samus
- 6,102
- 6
- 31
- 69
1
vote
1 answer
How to bind to Task in ObservableObject from CommunityToolkit.Mvvm?
ObservableObject from CommunityToolkit.Mvvm has API which allows to bind asynchronously to Task (https://github.com/MicrosoftDocs/CommunityToolkit/blob/main/docs/mvvm/ObservableObject.md#handling-taskt-properties)
Problem is the sample do not…

luk
- 13
- 4
1
vote
3 answers
How to use the MVVM RelayCommand Attribute?
I have been trying out attributes and ran in an issue trying to use the RelayCommand attribute from the Community Toolkit.
I looked over the
.NET Documentation on RelayCommand Attribute and tried to implement a simple example as follows:
using…

JasonC
- 139
- 8
1
vote
2 answers
Viewmodel's ObservableCollection and ObservableProperty is throwing a null reference exception
.net 7
CommunityToolKit.mvvm 8.1.0
I've got many pages working great in a .net maui application. In working on wiring another new page, I've encountered an odd issue. My viewmodel appears to be the same as the others that I have which are…

Zonus
- 2,313
- 2
- 26
- 48
1
vote
1 answer
Use [PrimaryKey,AutoIncrement] from SQLite in .NET MAUI with [ObservablePropertys]
As the Title says i defined my member, for example my Id, as an Observable Property with the CommunityToolKit.MVVM
[ObservableProperty]
private int id;
But now i am trying to give my Observable Property [PrimaryKey,AutoIncrement] from the SQLite…

Kioshia
- 13
- 4
1
vote
0 answers
.net Maui MVVM sample running on android not running on windows machine. System.AccessViolationException: 'Attempted to read or write protected memory
A sample App on .net maui with MVVM community.toolkit is running on Android simulator but not on windows machine, when i press the add button get this exception
System.AccessViolationException: 'Attempted to read or write protected memory. This is…

snikos
- 29
- 3
1
vote
2 answers
CommunityToolkit generated OnSelectionChanged command not working?
My project uses CommunityToolkit.Mvvm8.0.
I use the [RelayCommand] attributeto create a method to generate the command.
https://learn.microsoft.com/en-us/dotnet/communitytoolkit/mvvm/generators/overview
Why is Click working fine but…

wpf
- 103
- 6
1
vote
1 answer
Update Properties across Viewmodels with CommunityToolkit.Mvvm and Dependency Injection
I am trying to implement a simple WPF Application, with two nested UserControls inside the Mainwindow, and each UserControl having their own viewmodel. One Viewmodel implements a command which allows the user to choose a Directory. When a folder is…

Halil Ibrahim Özcan
- 111
- 1
- 9
1
vote
2 answers
Binding does not work for Platform dependent Behaviors
Binding to observable property does not work when I try to create my own custom behavior. Neither it does in any of community mvvm toolkit platform…

YMC
- 4,925
- 7
- 53
- 83
1
vote
0 answers
How to receive ALL message types using MVVM Community Toolkit
I have a large C# app that I'm porting to .NET 6. It uses a couple dozen different types of message, all of which are derived from my BaseMessage. With MVVM Light, I was able to receive a copy of any of the messages (for testing and logging) by…

ClarkG
- 81
- 9
1
vote
1 answer
RelayCommand in MVVM community toolkit does not respond to the observable property in WPF
I'm using ObservableProperty attribute from MVVM toolkit, for the string SearchString which has binding for the TextBlock.Text property. I want to start command once change in TextBlock was made so I have set the attribute for change…

JMan
- 60
- 7
1
vote
1 answer
WebView Navigated Event .NET MAUI using CommunityToolkit.MVVM and EventToCommand
I am using [RelayCommand] for handling the navigated event of WebView in .NET MAUI.
async void Navigated(WebNavigatedEventArgs args)
I have bound it in my XAML, using

H.A.H.
- 2,104
- 1
- 8
- 21