From 7ded5a70830aa3cc862e357f18fabeacabdc6882 Mon Sep 17 00:00:00 2001 From: Name Surname Date: Thu, 27 Feb 2025 15:27:30 +0300 Subject: [PATCH] initial 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.user | 5 ++++ 8 files changed, 207 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..c8d52a9 --- /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..da4e5b9 --- /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..17481e8 --- /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..24de810 --- /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..fb5c879 --- /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..89be44c --- /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..763acb3 --- /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.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