From b2ab71eb6053cc9f75c81fa651aa8f889c0cc539 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D1=83=D0=BF=D1=81=D0=B8=D0=BD=D1=8C?= Date: Thu, 27 Feb 2025 15:27:25 +0300 Subject: [PATCH] first commit2 --- FlyoutPage1.xaml | 16 +++++++++++++ FlyoutPage1.xaml.cs | 36 ++++++++++++++++++++++++++++ FlyoutPage1Detail.xaml | 9 +++++++ FlyoutPage1Detail.xaml.cs | 20 ++++++++++++++++ FlyoutPage1Flyout.xaml | 45 +++++++++++++++++++++++++++++++++++ FlyoutPage1Flyout.xaml.cs | 56 ++++++++++++++++++++++++++++++++++++++++++++ FlyoutPage1FlyoutMenuItem.cs | 20 ++++++++++++++++ MobileApp.csproj | 18 ++++++++++++++ MobileApp.csproj.user | 5 ++++ 9 files changed, 225 insertions(+) create mode 100644 FlyoutPage1.xaml create mode 100644 FlyoutPage1.xaml.cs create mode 100644 FlyoutPage1Detail.xaml create mode 100644 FlyoutPage1Detail.xaml.cs create mode 100644 FlyoutPage1Flyout.xaml create mode 100644 FlyoutPage1Flyout.xaml.cs create mode 100644 FlyoutPage1FlyoutMenuItem.cs diff --git a/FlyoutPage1.xaml b/FlyoutPage1.xaml new file mode 100644 index 0000000..4152620 --- /dev/null +++ b/FlyoutPage1.xaml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/FlyoutPage1.xaml.cs b/FlyoutPage1.xaml.cs new file mode 100644 index 0000000..19f6c05 --- /dev/null +++ b/FlyoutPage1.xaml.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +using Xamarin.Forms; +using Xamarin.Forms.Xaml; + +namespace MobileApp +{ + [XamlCompilation(XamlCompilationOptions.Compile)] + public partial class FlyoutPage1 : FlyoutPage + { + public FlyoutPage1() + { + InitializeComponent(); + FlyoutPage.ListView.ItemSelected += ListView_ItemSelected; + } + + private void ListView_ItemSelected(object sender, SelectedItemChangedEventArgs e) + { + var item = e.SelectedItem as FlyoutPage1FlyoutMenuItem; + if (item == null) + return; + + var page = (Page)Activator.CreateInstance(item.TargetType); + page.Title = item.Title; + + Detail = new NavigationPage(page); + IsPresented = false; + + FlyoutPage.ListView.SelectedItem = null; + } + } +} \ No newline at end of file diff --git a/FlyoutPage1Detail.xaml b/FlyoutPage1Detail.xaml new file mode 100644 index 0000000..b13a576 --- /dev/null +++ b/FlyoutPage1Detail.xaml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/FlyoutPage1Detail.xaml.cs b/FlyoutPage1Detail.xaml.cs new file mode 100644 index 0000000..737697b --- /dev/null +++ b/FlyoutPage1Detail.xaml.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +using Xamarin.Forms; +using Xamarin.Forms.Xaml; + +namespace MobileApp +{ + [XamlCompilation(XamlCompilationOptions.Compile)] + public partial class FlyoutPage1Detail : ContentPage + { + public FlyoutPage1Detail() + { + InitializeComponent(); + } + } +} \ No newline at end of file diff --git a/FlyoutPage1Flyout.xaml b/FlyoutPage1Flyout.xaml new file mode 100644 index 0000000..8652a0c --- /dev/null +++ b/FlyoutPage1Flyout.xaml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FlyoutPage1Flyout.xaml.cs b/FlyoutPage1Flyout.xaml.cs new file mode 100644 index 0000000..17f73ec --- /dev/null +++ b/FlyoutPage1Flyout.xaml.cs @@ -0,0 +1,56 @@ +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; + +using Xamarin.Forms; +using Xamarin.Forms.Xaml; + +namespace MobileApp +{ + [XamlCompilation(XamlCompilationOptions.Compile)] + public partial class FlyoutPage1Flyout : ContentPage + { + public ListView ListView; + + public FlyoutPage1Flyout() + { + InitializeComponent(); + + BindingContext = new FlyoutPage1FlyoutViewModel(); + ListView = MenuItemsListView; + } + + private class FlyoutPage1FlyoutViewModel : INotifyPropertyChanged + { + public ObservableCollection MenuItems { get; set; } + + public FlyoutPage1FlyoutViewModel() + { + MenuItems = new ObservableCollection(new[] + { + new FlyoutPage1FlyoutMenuItem { Id = 0, Title = "Page 1" }, + new FlyoutPage1FlyoutMenuItem { Id = 1, Title = "Page 2" }, + new FlyoutPage1FlyoutMenuItem { Id = 2, Title = "Page 3" }, + new FlyoutPage1FlyoutMenuItem { Id = 3, Title = "Page 4" }, + new FlyoutPage1FlyoutMenuItem { Id = 4, Title = "Page 5" }, + }); + } + + #region INotifyPropertyChanged Implementation + public event PropertyChangedEventHandler PropertyChanged; + void OnPropertyChanged([CallerMemberName] string propertyName = "") + { + if (PropertyChanged == null) + return; + + PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + #endregion + } + } +} \ No newline at end of file diff --git a/FlyoutPage1FlyoutMenuItem.cs b/FlyoutPage1FlyoutMenuItem.cs new file mode 100644 index 0000000..fa3a1ff --- /dev/null +++ b/FlyoutPage1FlyoutMenuItem.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MobileApp +{ + public class FlyoutPage1FlyoutMenuItem + { + public FlyoutPage1FlyoutMenuItem() + { + TargetType = typeof(FlyoutPage1FlyoutMenuItem); + } + public int Id { get; set; } + public string Title { get; set; } + + public Type TargetType { get; set; } + } +} \ No newline at end of file diff --git a/MobileApp.csproj b/MobileApp.csproj index b22f210..ec63ebf 100644 --- a/MobileApp.csproj +++ b/MobileApp.csproj @@ -57,6 +57,24 @@ + + + + + + + + MSBuild:UpdateDesignTimeXaml + + + MSBuild:UpdateDesignTimeXaml + + + MSBuild:UpdateDesignTimeXaml + + + + diff --git a/MobileApp.csproj.user b/MobileApp.csproj.user index 891593c..de29182 100644 --- a/MobileApp.csproj.user +++ b/MobileApp.csproj.user @@ -6,6 +6,11 @@ Windows Machine + + Code + + + Designer