完成页面导航功能
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
xmlns:vm="clr-namespace:DMS.WPF.ViewModels"
|
||||
xmlns:mo="clr-namespace:DMS.Core.Models;assembly=DMS.Core"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:tb="http://hardcodet.net/taskbar"
|
||||
xmlns:taskbarNotification="http://www.hardcodet.net/taskbar"
|
||||
Title="设备管理系统"
|
||||
@@ -32,7 +33,7 @@
|
||||
<DataTemplate x:Key="NavigationViewMenuItem"
|
||||
DataType="{x:Type mo:MenuBean}">
|
||||
<ui:NavigationViewItem Content="{Binding Header}"
|
||||
|
||||
Tag="{Binding }"
|
||||
MenuItemsSource="{Binding Children }">
|
||||
<ui:NavigationViewItem.Icon>
|
||||
<ui:FontIcon Glyph="{Binding Icon}" />
|
||||
@@ -61,10 +62,11 @@
|
||||
IsBackButtonVisible="Collapsed"
|
||||
IsBackEnabled="False"
|
||||
SelectionFollowsFocus="Disabled"
|
||||
SelectionChanged="NavigationView_SelectionChanged"
|
||||
MenuItemsSource="{Binding DataServices.MenuTrees}"
|
||||
MenuItemTemplate="{StaticResource NavigationViewMenuItem}"
|
||||
SelectionChanged="NavigationView_SelectionChanged">
|
||||
MenuItemTemplate="{StaticResource NavigationViewMenuItem}">
|
||||
|
||||
|
||||
|
||||
<ui:NavigationView.AutoSuggestBox>
|
||||
<ui:AutoSuggestBox AutomationProperties.Name="Search">
|
||||
|
||||
@@ -5,6 +5,7 @@ using DMS.WPF.ViewModels;
|
||||
using iNKORE.UI.WPF.Modern.Controls;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using DMS.Core.Enums;
|
||||
using DMS.WPF.ViewModels.Items;
|
||||
|
||||
namespace DMS.WPF.Views;
|
||||
|
||||
@@ -58,15 +59,12 @@ public partial class MainView : Window
|
||||
/// <param name="args"></param>
|
||||
private async void NavigationView_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args)
|
||||
{
|
||||
// var menu = args.SelectedItem as MenuBean;
|
||||
// if (menu != null)
|
||||
// {
|
||||
// await _viewModel.MenuSelectionChanged(menu);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// NotificationHelper.ShowError("选择的菜单项为空!");
|
||||
// }
|
||||
var menu = args.SelectedItem as MenuBeanItemViewModel;
|
||||
if (menu != null)
|
||||
{
|
||||
await _viewModel.MenuSelectionChanged(menu);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private async void MainView_OnLoaded(object sender, RoutedEventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user