From 768edfcb6c9bc8b9435b5fb0c035d0a4a3a3de99 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Sun, 29 Jan 2023 03:05:17 -0500 Subject: [PATCH] Update control catalog --- .../ControlCatalog/Pages/DataGridPage.xaml | 22 +++++++++++-------- .../ControlCatalog/Pages/DataGridPage.xaml.cs | 13 ++++++----- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/samples/ControlCatalog/Pages/DataGridPage.xaml b/samples/ControlCatalog/Pages/DataGridPage.xaml index 4c3c211ca5..c39e9f0a81 100644 --- a/samples/ControlCatalog/Pages/DataGridPage.xaml +++ b/samples/ControlCatalog/Pages/DataGridPage.xaml @@ -1,7 +1,9 @@ + xmlns:pages="clr-namespace:ControlCatalog.Pages" + x:Class="ControlCatalog.Pages.DataGridPage" + x:DataType="pages:DataGridPage"> @@ -33,7 +35,7 @@ - + - + + - - - - + + + + - + - + diff --git a/samples/ControlCatalog/Pages/DataGridPage.xaml.cs b/samples/ControlCatalog/Pages/DataGridPage.xaml.cs index 3565d113bc..b0c3e3a553 100644 --- a/samples/ControlCatalog/Pages/DataGridPage.xaml.cs +++ b/samples/ControlCatalog/Pages/DataGridPage.xaml.cs @@ -1,5 +1,6 @@ using System.Collections; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.ComponentModel; using System.Linq; using Avalonia.Controls; @@ -48,20 +49,22 @@ namespace ControlCatalog.Pages var dg3 = this.Get("dataGridEdit"); dg3.IsReadOnly = false; - var items = new List + var list = new ObservableCollection { new Person { FirstName = "John", LastName = "Doe" , Age = 30}, new Person { FirstName = "Elizabeth", LastName = "Thomas", IsBanned = true , Age = 40 }, new Person { FirstName = "Zack", LastName = "Ward" , Age = 50 } }; - var collectionView3 = new DataGridCollectionView(items); - - dg3.Items = collectionView3; + DataGrid3Source = list; var addButton = this.Get