Questions tagged [community-toolkit-mvvm]

85 questions
0
votes
0 answers

why and do not work?

My project is in.NET 6. Why doesn't the following code work? My understanding is to produce code through attributes, simplifying the coding. Did I do something wrong? Xaml:
wpf
  • 103
  • 6
0
votes
1 answer

Can I specify the auto-generated property name when using the [ObservableProperty] attribute with CommunityToolkit.MVVM?

Is it possible to specify the name of the auto-generated property for a private field that is decorated with the [ObservableProperty] attribute? For example, if I have a field, string address, that has this attribute, the toolkit will generate a…
blueshift
  • 831
  • 2
  • 12
  • 24
0
votes
1 answer

WinUI 3 CommunityToolkit Datagrid displaying data from two models while using CommunityToolkit.Mvvm

I have two models in my data access layer: Table1 and Table2. I want to use the WinUI 3 DataGrid from the CommunityToolkit to display two columns from each table: Table1.ColumnA, Table1.ColumnB, Table2.ColumnC, Table2.ColumnD My thought was to use…
E. A. Bagby
  • 824
  • 9
  • 24
0
votes
1 answer

NET MAUI CommunityToolkit.MVVM throws error on email validation attribute

I have wrote an email validation attribute. [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)] public class EmailAttribute : RegularExpressionAttribute { public EmailAttribute() :…
0
votes
3 answers

.NET MAUI Communitytoolkit.Mvvm: How to bind an object instead of a string

i already the project from the official tutorial of .NET MAUI until step 5 using Communitytoolkit.Mvvm: text Now, instead of binding only a Text (which is a standard type that can be accessed from everywhere) i would like to bind a simple object…
user8431033
0
votes
1 answer

DataGrid from CommunityToolkit.WinUI.Controls.DataGrid not updating when bound ObservableCollection changes

I have a dropdown with three filter options: All, Active, and Inactive. Changing the selected value raises an event that adjusts the observable collection property ProjectDbUsers in the ViewModel, which a Datagrid showing application users is bound…
E. A. Bagby
  • 824
  • 9
  • 24
0
votes
1 answer

Update ObservableCollection item and related view, when the item implements an interface

As written everywhere (e.g. here, here, here, here...), reporting an ObservableCollection item property change to a view requires the item to implement INotifyPropertyChanged. Using CommunityToolkit.Mvvm this can be done using an attribute: public…
0
votes
1 answer

Data-binded value won't get updated on UI

I have a class called Commander and it have a property called CurrentRound and it gets updated every few seconds internally. I'm using CommunityToolkit.MVVM and In my viewmodel I declared an observable property called CurrentRound and in the…
0
votes
0 answers

net maui form validation

Still learning. I am trying to do a model validation using CommunityToolkit.Mvvm and I stuck in the styles (min there). Here is what i tried: Model: public abstract partial class BaseModel : ObservableObject, IDataErrorInfo { private…
Wasyster
  • 2,279
  • 4
  • 26
  • 58
0
votes
0 answers

MAUI Call a function after bound property update

I'm working on a; .Net7 MAUI app. CommunityToolkit.Maui 3.1.0 CommunityToolkit.Mvvm 8.1.0-p2 I have a DatePicker in my xaml bound to a DateTime property (date of birth (dob)) in the ViewModel. [ObservableProperty] private DateTime…
0
votes
1 answer

Collectionview SelectionChangeCommand doesn´t work with CommunityToolkit.Mvvm .NET MAUI

I have a simple project using Community Toolkit Mvvm tool and a collectionview. The issue is that the SelectionChangeCommand of the CollectionView doesn´t fired when I select an element of the collection. I created this project because on another…
0
votes
0 answers

C# CommunityToolkit - INotifyPropertyChanged with inheritance

Recently I found that it is possible to auto-generate code for INotifyPropertyChanged with the use of CommunityToolkit. But I stubbed upon a problem. I have a DTO class that is retrieved from the backend (and stored in shared project used by both FE…
0
votes
1 answer

.NET MAUI: Implementing Logout Functionality

I am trying to implement logout functionality in my app. Once I logout, how should refresh all the pages to display content corresponding to the logout state? Tried running a check method on each page during initialization. The problem is that this…
0
votes
2 answers

Observable Validator does not work in wpf

I am working in wpf mvvm app, and I also use Community toolkit.mvvm also. Here I implement Observable validator for textboxes but it does not effect on user interface, ViewModel: public partial class UserViewModel : ObservableValidator { …
0
votes
2 answers

MAUI Community Toolkit EventToCommandBehavior

I'm desperately trying to adhere to the MVVM design pattern in my App. So I'm trying to use the EventToCommandBehavior behavior from the MCT. (I'm also using the CommunityToolkit.Mvvm for [RelayCommand]) I've attached it to an Entry and am trying to…