Я хочу отобразить подменю для одного элемента, который находится в навигационном ящике. Я хочу добавить 5 элементов подменю для одного элемента, который находится в навигационном блоке.
Какой из них является лучшим и простым способом добавить подменю для элемента? И я хочу использовать это подменю в приложениях android и IOS.
MasterDetailPage.cs:
public MainMasterDetailPage()
{
InitializeComponent();
NavigationPage.SetHasBackButton(this, false);
NavigationPage.SetHasNavigationBar(this, false);
navigationDrawerList.ItemsSource = GetMasterPageLists();
this.IsPresented = false;
Detail = new NavigationPage(new DashboardTabbedPage());
}
private void OnMenuSelected(object sender, SelectedItemChangedEventArgs e)
{
var item = (MasterPageList)e.SelectedItem;
if (item.Title == "Settings")
{
}
else
{
string dbPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "vssSQLite.db3");
SQLiteConnection db = new SQLiteConnection(dbPath);
db.DropTable<LoginSqlLiteM>();
Application.Current.MainPage.Navigation.PushAsync(new MainPage());
}
}
List<MasterPageList> GetMasterPageLists()
{
return new List<MasterPageList>
{
new MasterPageList() { Title = "Settings", Icon = "settings.png" },
new MasterPageList() { Title = "Logout", Icon = "logout.png" },
};
}
}
MasterDetailPage.Xaml :
<MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:VSS.MasterPages"
xmlns:local1="clr-namespace:VSS.Pages"
IsPresented="False"
x:Class="VSS.MasterPages.MainMasterDetailPage">
<MasterDetailPage.Master>
<ContentPage Title="☰">
<StackLayout BackgroundColor="#ffffff">
<StackLayout Margin="25,10,25,0" Padding="0,15,0,15">
<Image Source="VSSIcon.png" HorizontalOptions="Center" HeightRequest="80" WidthRequest="80"></Image>
<Label Text="Sched.ly" TextColor="#1CA9FF" FontSize="Large" HorizontalOptions="CenterAndExpand"></Label>
<Label Text="Always on Time " TextColor="#1CA9FF" FontSize="Large" FontAttributes="Italic" HorizontalOptions="CenterAndExpand"></Label>
</StackLayout>
<ListView x:Name="navigationDrawerList"
RowHeight="60"
SeparatorVisibility="None"
ItemSelected="OnMenuSelected"
BackgroundColor="#2196F3">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout VerticalOptions="FillAndExpand"
Orientation="Horizontal"
Padding="20,10,0,10"
Spacing="20">
<Image Source="{Binding Icon}"
WidthRequest="30"
HeightRequest="30"
VerticalOptions="Center" />
<Label Text="{Binding Title}"
FontSize="Medium"
VerticalOptions="Center"
TextColor="White"/>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</ContentPage>
</MasterDetailPage.Master>
<MasterDetailPage.Detail>
<NavigationPage>
<x:Arguments>
<local:DashboardTabbedPage/>
</x:Arguments>
</NavigationPage>
</MasterDetailPage.Detail>
</MasterDetailPage>

Я хочу отобразить элементы подменю для элемента Settings
. Как я могу сделать это подменю для settings
элемента?
Помогите мне.