From a2b75d2ce4285c6a678891b1c9bebae9cd2f88bb Mon Sep 17 00:00:00 2001 From: Alexandre Agostinho Date: Mon, 5 Jun 2023 15:47:52 +0200 Subject: [PATCH] home working, little issue on search --- .../ReadOnlyObservableRecipeCollection.cs | 24 +++++++++++++++++++ MCTG/Model/Recipes/RecipeCollection.cs | 3 +++ MCTG/Views/ContentPages/Home.xaml | 12 +++++----- MCTG/Views/ContentPages/Home.xaml.cs | 10 +++----- MCTG/Views/ContentViews/ContainerBase.xaml.cs | 1 - 5 files changed, 36 insertions(+), 14 deletions(-) create mode 100644 MCTG/Model/Recipes/ReadOnlyObservableRecipeCollection.cs diff --git a/MCTG/Model/Recipes/ReadOnlyObservableRecipeCollection.cs b/MCTG/Model/Recipes/ReadOnlyObservableRecipeCollection.cs new file mode 100644 index 0000000..8def54c --- /dev/null +++ b/MCTG/Model/Recipes/ReadOnlyObservableRecipeCollection.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text; +using System.Threading.Tasks; + +namespace Model +{ + public class ReadOnlyObservableRecipeCollection : ReadOnlyObservableCollection + { + private RecipeCollection _recipeObserved; + + public string Description => _recipeObserved.Description; + + public ReadOnlyObservableRecipeCollection(RecipeCollection recipeCollection) + : base(recipeCollection) + { + _recipeObserved = recipeCollection; + } + } +} diff --git a/MCTG/Model/Recipes/RecipeCollection.cs b/MCTG/Model/Recipes/RecipeCollection.cs index f09baaa..c58bda2 100644 --- a/MCTG/Model/Recipes/RecipeCollection.cs +++ b/MCTG/Model/Recipes/RecipeCollection.cs @@ -2,6 +2,7 @@ using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel; using System.Text; namespace Model @@ -31,6 +32,8 @@ namespace Model _description = "No description."; else _description = value; + + OnPropertyChanged(new PropertyChangedEventArgs("Description")); } } #endregion diff --git a/MCTG/Views/ContentPages/Home.xaml b/MCTG/Views/ContentPages/Home.xaml index 1f2536b..38b81e3 100644 --- a/MCTG/Views/ContentPages/Home.xaml +++ b/MCTG/Views/ContentPages/Home.xaml @@ -8,8 +8,7 @@ x:Name="homepage"> + NeedReturn="False"> @@ -20,7 +19,7 @@ Margin="20, 10, 15, 0"/> @@ -52,10 +51,11 @@ - +