This repository has been archived on 2020-12-20. You can view files and clone it, but cannot push or open issues or pull requests.
aurora-sharp-desktop/Aurora/Frontend/Views/MainView/MainView.xaml.cs

36 lines
984 B
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using Aurora.Frontend.Components.NavigationMenu;
using Aurora.Frontend.Views.MainView;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace Aurora.Frontend.Views.Main
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class MainView : MasterDetailPage
{
public MainView()
{
InitializeComponent();
BindingContext = new MainViewModel();
MasterPage.ListView.ItemSelected += ListView_ItemSelected;
}
private void ListView_ItemSelected(object sender, SelectedItemChangedEventArgs e)
{
var item = e.SelectedItem as NavigationItem;
if (item == null)
return;
var page = (Page)Activator.CreateInstance(item.TargetType);
page.Title = item.Title;
Detail = new NavigationPage(page);
MasterPage.ListView.SelectedItem = null;
}
}
}