47 lines
1.3 KiB
C#
47 lines
1.3 KiB
C#
using MobileApp1.Models;
|
|
using System;
|
|
using Xamarin.Forms;
|
|
using Xamarin.Forms.Xaml;
|
|
|
|
namespace MobileApp1.Views
|
|
{
|
|
[XamlCompilation(XamlCompilationOptions.Compile)]
|
|
public partial class MainPage : FlyoutPage
|
|
{
|
|
public MainPage()
|
|
{
|
|
InitializeComponent();
|
|
|
|
flyoutPage.listView.ItemSelected += listView1_OnItemSelected;
|
|
}
|
|
|
|
//private void ListView_ItemSelected(object sender, SelectedItemChangedEventArgs e)
|
|
//{
|
|
// var item = e.SelectedItem as MainPageFlyoutMenuItem;
|
|
// 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;
|
|
//}
|
|
|
|
private void listView1_OnItemSelected(object sender, SelectedItemChangedEventArgs e)
|
|
{
|
|
var item = e.SelectedItem as FlyoutPageItem;
|
|
if (item == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
Detail = new NavigationPage((Page)Activator.CreateInstance(item.TargetType));
|
|
flyoutPage.listView.SelectedItem = null;
|
|
IsPresented = false;
|
|
}
|
|
|
|
}
|
|
} |