Skip to content
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

Update row column data after change de ItemSource #64

Closed
paoc77 opened this issue Feb 3, 2023 · 1 comment
Closed

Update row column data after change de ItemSource #64

paoc77 opened this issue Feb 3, 2023 · 1 comment

Comments

@paoc77
Copy link

paoc77 commented Feb 3, 2023

Hi, in runtime using mvvm community toolkit is possible to update a cell, after some property change?
I set my binding in the view with C#
dataGrid.SetBinding(DataGrid.ItemsSourceProperty, nameof(attachmenListViewModel.Attachments), BindingMode.TwoWay);

in the viewmodel:
public ObservableCollection Attachments { get; } = new();

I load the data and it shows the info Ok in the Grid

later in a command
Attachments.First().Status = "Requested";
Nothing happens

Can you please help me with this issue, I'm missing something ? Thanks

@symbiogenesis
Copy link
Collaborator

symbiogenesis commented Feb 4, 2023

The Attachment object would need to inherit from INotifyPropertyChanged and the Status property would need to fire an OnPropertyChanged event in the setter.

If you do that, then the properties should update. I just tried it, and it works fine.

See the latest commit in this branch for an example:

https://github.com/symbiogenesis/Maui.DataGrid/tree/fix-64

I am closing this issue, but if you need more help then you can ask another question here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants