From 1e53769fcea7c0b6dae3b1a6c642c410f5be50a6 Mon Sep 17 00:00:00 2001 From: Maxime BATISTA Date: Wed, 3 May 2023 14:22:00 +0200 Subject: [PATCH] end create recipe page --- Pages/CreateRecipePage.xaml | 4 +--- Pages/CreateRecipePage.xaml.cs | 2 +- Views/StepEntry.xaml | 30 +++++++++++++++++++++--------- Views/StepEntry.xaml.cs | 12 ++++++++---- 4 files changed, 31 insertions(+), 17 deletions(-) diff --git a/Pages/CreateRecipePage.xaml b/Pages/CreateRecipePage.xaml index 0bd7bd9..58fc1b1 100644 --- a/Pages/CreateRecipePage.xaml +++ b/Pages/CreateRecipePage.xaml @@ -123,9 +123,7 @@ - + diff --git a/Pages/CreateRecipePage.xaml.cs b/Pages/CreateRecipePage.xaml.cs index 873de86..7cacaa7 100644 --- a/Pages/CreateRecipePage.xaml.cs +++ b/Pages/CreateRecipePage.xaml.cs @@ -16,6 +16,6 @@ public partial class CreateRecipePage : ContentPage private void OnAddStepTapped(object sender, TappedEventArgs e) { - StepList.Children.Add(new Entry()); + StepList.Children.Add(new StepEntry((uint) StepList.Children.Count() + 1)); } } \ No newline at end of file diff --git a/Views/StepEntry.xaml b/Views/StepEntry.xaml index 2a58c50..ffed80e 100644 --- a/Views/StepEntry.xaml +++ b/Views/StepEntry.xaml @@ -3,15 +3,27 @@ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="ShoopNCook.Views.StepEntry"> - diff --git a/Views/StepEntry.xaml.cs b/Views/StepEntry.xaml.cs index 5dc1576..1807de5 100644 --- a/Views/StepEntry.xaml.cs +++ b/Views/StepEntry.xaml.cs @@ -2,14 +2,18 @@ namespace ShoopNCook.Views; public partial class StepEntry : ContentView { - private readonly BindableProperty OrdinalProperty = BindableProperty.Create(nameof(OrdinalLabel), typeof(uint), typeof(StepEntry), default(uint)); - public StepEntry() + + public StepEntry(): this(1) + {} + + public StepEntry(uint ordinal) { InitializeComponent(); + Ordinal = ordinal; } public uint Ordinal { - get => (uint)GetValue(OrdinalProperty); - set => SetValue(OrdinalProperty, value); + get => uint.Parse(OrdinalLabel.Text); + set => OrdinalLabel.Text = value.ToString(); } } \ No newline at end of file