From 03d02a606ba483f5e23a6a40924514df7e31c7e2 Mon Sep 17 00:00:00 2001 From: "maxime.BATISTA@etu.uca.fr" Date: Tue, 11 Apr 2023 16:31:29 +0200 Subject: [PATCH] Add bindings to Recipe views --- Resources/Images/password_icon.svg | 2 +- Resources/Images/plus.svg | 4 +- ShoopNCook.csproj | 3 + Views/IngredientView.xaml | 24 ++++++ Views/IngredientView.xaml.cs | 41 +++++++++++ Views/RecipePage.xaml | 114 ++++++++++++++++------------- Views/RecipePage.xaml.cs | 86 +++++++++++++++++++++- 7 files changed, 219 insertions(+), 55 deletions(-) create mode 100644 Views/IngredientView.xaml create mode 100644 Views/IngredientView.xaml.cs diff --git a/Resources/Images/password_icon.svg b/Resources/Images/password_icon.svg index 7a823a5..e242a3d 100644 --- a/Resources/Images/password_icon.svg +++ b/Resources/Images/password_icon.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/Resources/Images/plus.svg b/Resources/Images/plus.svg index aa718df..ffcb182 100644 --- a/Resources/Images/plus.svg +++ b/Resources/Images/plus.svg @@ -1 +1,3 @@ - \ No newline at end of file + + + \ No newline at end of file diff --git a/ShoopNCook.csproj b/ShoopNCook.csproj index ab4d16c..de34a4b 100644 --- a/ShoopNCook.csproj +++ b/ShoopNCook.csproj @@ -77,6 +77,9 @@ + + MSBuild:Compile + MSBuild:Compile diff --git a/Views/IngredientView.xaml b/Views/IngredientView.xaml new file mode 100644 index 0000000..693cdde --- /dev/null +++ b/Views/IngredientView.xaml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/Views/IngredientView.xaml.cs b/Views/IngredientView.xaml.cs new file mode 100644 index 0000000..01288d8 --- /dev/null +++ b/Views/IngredientView.xaml.cs @@ -0,0 +1,41 @@ +namespace ShoopNCook.Views; + +public partial class IngredientView : ContentView +{ + + public static readonly BindableProperty NameProperty = + BindableProperty.Create(nameof(Name), typeof(string), typeof(IngredientView), default(string)); + + public static readonly BindableProperty QuantityProperty = + BindableProperty.Create(nameof(Quantity), typeof(float), typeof(IngredientView), default(float)); + + public static readonly BindableProperty UnitProperty = + BindableProperty.Create(nameof(Unit), typeof(string), typeof(IngredientView), default(string)); + + public string Name + { + get => (string)GetValue(NameProperty); + set => SetValue(NameProperty, value); + } + + public float Quantity + { + get => (float)GetValue(QuantityProperty); + set => SetValue(QuantityProperty, value); + } + + public string Unit + { + get => (string)GetValue(UnitProperty); + set => SetValue(UnitProperty, value); + } + + public IngredientView(string name, float quantity, string unit) + { + InitializeComponent(); + + Name = name; + Quantity = quantity; + Unit = unit; + } +} \ No newline at end of file diff --git a/Views/RecipePage.xaml b/Views/RecipePage.xaml index 0e2527a..95bb063 100644 --- a/Views/RecipePage.xaml +++ b/Views/RecipePage.xaml @@ -25,12 +25,14 @@ Source="arrow_back.svg"/>