From 5bd4d688a720ac248f0545f39fcd29a8e2038d53 Mon Sep 17 00:00:00 2001 From: Alexandre Agostinho Date: Sat, 8 Apr 2023 16:37:20 +0200 Subject: [PATCH] :recycle: refactor custom flyout with content binding --- MCTG/Views/ContainerBase.xaml | 9 ++++-- MCTG/Views/ContainerBase.xaml.cs | 11 ++++++- ...CustomFlyout.xaml => ContainerFlyout.xaml} | 31 +++++++------------ MCTG/Views/ContainerFlyout.xaml.cs | 18 +++++++++++ MCTG/Views/CustomFlyout.xaml.cs | 9 ------ MCTG/Views/CustomHeader.xaml | 2 +- MCTG/Views/Home.xaml | 28 ++++++++++++++--- MCTG/Views/Resources/Styles/Colors.xaml | 3 +- MCTG/Views/Resources/Styles/Styles.xaml | 11 ++++++- MCTG/Views/Views.csproj | 10 +++++- 10 files changed, 92 insertions(+), 40 deletions(-) rename MCTG/Views/{CustomFlyout.xaml => ContainerFlyout.xaml} (51%) create mode 100644 MCTG/Views/ContainerFlyout.xaml.cs delete mode 100644 MCTG/Views/CustomFlyout.xaml.cs diff --git a/MCTG/Views/ContainerBase.xaml b/MCTG/Views/ContainerBase.xaml index 0c862d7..651d6b1 100644 --- a/MCTG/Views/ContainerBase.xaml +++ b/MCTG/Views/ContainerBase.xaml @@ -13,10 +13,15 @@ MinimumHeightRequest="80" VerticalOptions="StartAndExpand"/> - + HorizontalOptions="StartAndExpand"> + + + + (View)GetValue(MyContentProperty); set => SetValue(MyContentProperty, value); } + + public static readonly BindableProperty MyFlyoutContentProperty = + BindableProperty.Create("MyFlyoutContent", typeof(View), typeof(ContainerBase), new Grid()); + + public View MyFlyoutContent + { + get => (View)GetValue(MyFlyoutContentProperty); + set => SetValue(MyFlyoutContentProperty, value); + } } diff --git a/MCTG/Views/CustomFlyout.xaml b/MCTG/Views/ContainerFlyout.xaml similarity index 51% rename from MCTG/Views/CustomFlyout.xaml rename to MCTG/Views/ContainerFlyout.xaml index 36b747d..2bfa4c0 100644 --- a/MCTG/Views/CustomFlyout.xaml +++ b/MCTG/Views/ContainerFlyout.xaml @@ -1,7 +1,9 @@ @@ -14,30 +16,21 @@ BorderWidth="5" BorderColor="Black" IsEnabled="False"/>