Avalonia.Controls.TreeDataGrid icon indicating copy to clipboard operation
Avalonia.Controls.TreeDataGrid copied to clipboard

Redraw cells on property change

Open modmanx opened this issue 1 year ago • 4 comments

Hello, i'm trying out TreeDataGrid - Flat view and would like to achieve to update UI when property is changed. Reading the docs, this should work.

Currently I need to scroll out and back in the row to get updated content.

This is same in TreeDataGridDemo sample, if you add code below to To CountriesPageViewModel.cs

            Task.Run(async () =>
            {
                for (var ii = 0; ii < 10; ii++)
                {
                    _data[0].Population = ii * 1000;
                    await Task.Delay(1000);
                }
            });

Is there any way to at least force redraw?

Thank you

modmanx avatar Aug 04 '22 12:08 modmanx

Does your view model with Population property implements INotifyPropertyChanged?

maxkatz6 avatar Aug 04 '22 16:08 maxkatz6

Thank you for replying, we have added : ReactiveObject to Country class in sample. This one implements INotifyPropertyChanged.

modmanx avatar Aug 05 '22 05:08 modmanx

Strangely enough, if I click on Country column for example, cell starts to get redrawn :)

modmanx avatar Aug 06 '22 10:08 modmanx

Related to this: https://github.com/AvaloniaUI/Avalonia/issues/8913

SuperJMN avatar Sep 08 '22 08:09 SuperJMN