Skip to content

Commit 646582e

Browse files
committed
add ui thread invocation for treedatagrid selection
1 parent 99312bf commit 646582e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Gui/ViewModels/FolderTreeViewModel.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using Avalonia.Controls;
22
using Avalonia.Controls.Models.TreeDataGrid;
33
using Avalonia.Controls.Selection;
4+
using Avalonia.Threading;
45
using OpenLoco.Dat.Data;
56
using OpenLoco.Definitions.Database;
67
using OpenLoco.Definitions.Web;
@@ -239,7 +240,10 @@ void UpdateGrid(List<FileSystemItemBase> items)
239240
},
240241
};
241242

242-
TreeDataGridSource.RowSelection!.SelectionChanged += SelectionChanged;
243+
Dispatcher.UIThread.Invoke(new Action(() =>
244+
{
245+
TreeDataGridSource.RowSelection!.SelectionChanged += SelectionChanged;
246+
}));
243247

244248
this.RaisePropertyChanged(nameof(TreeDataGridSource));
245249

0 commit comments

Comments
 (0)