add:NewNewSettings
This commit is contained in:
@@ -0,0 +1,17 @@
|
|||||||
|
<ui:Page
|
||||||
|
x:Class="Ink_Canvas.Windows.SettingsViews2.Pages.About"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||||
|
xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf"
|
||||||
|
Title="关于"
|
||||||
|
mc:Ignorable="d">
|
||||||
|
<Grid>
|
||||||
|
<StackPanel Margin="24">
|
||||||
|
<TextBlock Text="关于 InkCanvasForClass" Style="{DynamicResource TitleTextBlockStyle}" Margin="0,0,0,16" />
|
||||||
|
<TextBlock Text="这里是关于页面" Style="{DynamicResource BodyTextBlockStyle}" />
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</ui:Page>
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using iNKORE.UI.WPF.Modern.Controls;
|
||||||
|
|
||||||
|
namespace Ink_Canvas.Windows.SettingsViews2.Pages
|
||||||
|
{
|
||||||
|
public partial class About : Page
|
||||||
|
{
|
||||||
|
public About()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<ui:Page
|
||||||
|
x:Class="Ink_Canvas.Windows.SettingsViews2.Pages.SettingsPage"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||||
|
xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf"
|
||||||
|
Title="设置"
|
||||||
|
mc:Ignorable="d">
|
||||||
|
<Grid>
|
||||||
|
<StackPanel Margin="24">
|
||||||
|
<TextBlock Text="设置" Style="{DynamicResource TitleTextBlockStyle}" Margin="0,0,0,16" />
|
||||||
|
<TextBlock Text="这里是设置页面" Style="{DynamicResource BodyTextBlockStyle}" />
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</ui:Page>
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using iNKORE.UI.WPF.Modern.Controls;
|
||||||
|
|
||||||
|
namespace Ink_Canvas.Windows.SettingsViews2.Pages
|
||||||
|
{
|
||||||
|
public partial class SettingsPage : Page
|
||||||
|
{
|
||||||
|
public SettingsPage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -35,6 +35,8 @@
|
|||||||
SelectionChanged="OnNavigationViewSelectionChanged"
|
SelectionChanged="OnNavigationViewSelectionChanged"
|
||||||
BackRequested="OnNavigationViewBackRequested"
|
BackRequested="OnNavigationViewBackRequested"
|
||||||
IsSettingsVisible="True"
|
IsSettingsVisible="True"
|
||||||
|
IsBackButtonVisible="Visible"
|
||||||
|
IsBackEnabled="True"
|
||||||
PaneDisplayMode="Auto"
|
PaneDisplayMode="Auto"
|
||||||
ScrollViewer.VerticalScrollBarVisibility="Hidden"
|
ScrollViewer.VerticalScrollBarVisibility="Hidden"
|
||||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
|
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
|
||||||
|
|||||||
@@ -25,7 +25,9 @@ namespace Ink_Canvas.Windows.SettingsViews2
|
|||||||
{ "Typography", typeof(Typography) },
|
{ "Typography", typeof(Typography) },
|
||||||
{ "Theme", typeof(Theme) },
|
{ "Theme", typeof(Theme) },
|
||||||
{ "Colors", typeof(Colors) },
|
{ "Colors", typeof(Colors) },
|
||||||
{ "Fonts", typeof(Fonts) }
|
{ "Fonts", typeof(Fonts) },
|
||||||
|
{ "About", typeof(About) },
|
||||||
|
{ "Settings", typeof(SettingsPage) }
|
||||||
};
|
};
|
||||||
|
|
||||||
// 默认选中第一个项目
|
// 默认选中第一个项目
|
||||||
@@ -39,8 +41,8 @@ namespace Ink_Canvas.Windows.SettingsViews2
|
|||||||
{
|
{
|
||||||
if (args.IsSettingsSelected)
|
if (args.IsSettingsSelected)
|
||||||
{
|
{
|
||||||
// 暂时导航到 Page1 作为设置页示例
|
// 导航到设置页面
|
||||||
NavigateToPage("Page1");
|
NavigateToPage("Settings");
|
||||||
}
|
}
|
||||||
else if (args.SelectedItem is iNKORE.UI.WPF.Modern.Controls.NavigationViewItem item)
|
else if (args.SelectedItem is iNKORE.UI.WPF.Modern.Controls.NavigationViewItem item)
|
||||||
{
|
{
|
||||||
@@ -48,7 +50,7 @@ namespace Ink_Canvas.Windows.SettingsViews2
|
|||||||
if (item.MenuItems.Count == 0)
|
if (item.MenuItems.Count == 0)
|
||||||
{
|
{
|
||||||
// 如果是子导航项,直接导航
|
// 如果是子导航项,直接导航
|
||||||
var tag = item.Tag as string;
|
string tag = item.Tag as string;
|
||||||
if (!string.IsNullOrEmpty(tag))
|
if (!string.IsNullOrEmpty(tag))
|
||||||
{
|
{
|
||||||
NavigateToPage(tag);
|
NavigateToPage(tag);
|
||||||
@@ -81,16 +83,16 @@ namespace Ink_Canvas.Windows.SettingsViews2
|
|||||||
|
|
||||||
private void OnControlsSearchBoxQuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
|
private void OnControlsSearchBoxQuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
|
||||||
{
|
{
|
||||||
var query = args.QueryText.ToLower();
|
string query = args.QueryText.ToLower();
|
||||||
var allItems = new List<object>();
|
List<object> allItems = new List<object>();
|
||||||
foreach (var item in NavigationViewControl.MenuItems) allItems.Add(item);
|
foreach (object item in NavigationViewControl.MenuItems) allItems.Add(item);
|
||||||
foreach (var item in NavigationViewControl.FooterMenuItems) allItems.Add(item);
|
foreach (object item in NavigationViewControl.FooterMenuItems) allItems.Add(item);
|
||||||
|
|
||||||
foreach (var item in allItems)
|
foreach (object item in allItems)
|
||||||
{
|
{
|
||||||
if (item is iNKORE.UI.WPF.Modern.Controls.NavigationViewItem navItem)
|
if (item is iNKORE.UI.WPF.Modern.Controls.NavigationViewItem navItem)
|
||||||
{
|
{
|
||||||
var content = navItem.Content?.ToString().ToLower();
|
string content = navItem.Content?.ToString().ToLower();
|
||||||
if (content != null && content.Contains(query))
|
if (content != null && content.Contains(query))
|
||||||
{
|
{
|
||||||
NavigationViewControl.SelectedItem = navItem;
|
NavigationViewControl.SelectedItem = navItem;
|
||||||
@@ -104,18 +106,18 @@ namespace Ink_Canvas.Windows.SettingsViews2
|
|||||||
{
|
{
|
||||||
if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
|
if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
|
||||||
{
|
{
|
||||||
var query = sender.Text.ToLower();
|
string query = sender.Text.ToLower();
|
||||||
var suggestions = new List<string>();
|
List<string> suggestions = new List<string>();
|
||||||
|
|
||||||
var allItems = new List<object>();
|
List<object> allItems = new List<object>();
|
||||||
foreach (var item in NavigationViewControl.MenuItems) allItems.Add(item);
|
foreach (object item in NavigationViewControl.MenuItems) allItems.Add(item);
|
||||||
foreach (var item in NavigationViewControl.FooterMenuItems) allItems.Add(item);
|
foreach (object item in NavigationViewControl.FooterMenuItems) allItems.Add(item);
|
||||||
|
|
||||||
foreach (var item in allItems)
|
foreach (object item in allItems)
|
||||||
{
|
{
|
||||||
if (item is iNKORE.UI.WPF.Modern.Controls.NavigationViewItem navItem)
|
if (item is iNKORE.UI.WPF.Modern.Controls.NavigationViewItem navItem)
|
||||||
{
|
{
|
||||||
var content = navItem.Content?.ToString();
|
string content = navItem.Content?.ToString();
|
||||||
if (content != null && content.ToLower().Contains(query))
|
if (content != null && content.ToLower().Contains(query))
|
||||||
{
|
{
|
||||||
suggestions.Add(content);
|
suggestions.Add(content);
|
||||||
@@ -138,13 +140,13 @@ namespace Ink_Canvas.Windows.SettingsViews2
|
|||||||
private void OnRootFrameNavigated(object sender, NavigationEventArgs e)
|
private void OnRootFrameNavigated(object sender, NavigationEventArgs e)
|
||||||
{
|
{
|
||||||
// 更新NavigationView的选中状态
|
// 更新NavigationView的选中状态
|
||||||
var pageType = e.SourcePageType;
|
Type pageType = rootFrame.SourcePageType;
|
||||||
foreach (var kvp in _pageTypes)
|
foreach (KeyValuePair<string, Type> kvp in _pageTypes)
|
||||||
{
|
{
|
||||||
if (kvp.Value == pageType)
|
if (kvp.Value == pageType)
|
||||||
{
|
{
|
||||||
// 找到对应的NavigationViewItem
|
// 找到对应的NavigationViewItem
|
||||||
var item = FindNavigationViewItemByTag(kvp.Key);
|
NavigationViewItem item = FindNavigationViewItemByTag(kvp.Key);
|
||||||
if (item != null)
|
if (item != null)
|
||||||
{
|
{
|
||||||
NavigationViewControl.SelectedItem = item;
|
NavigationViewControl.SelectedItem = item;
|
||||||
@@ -157,8 +159,8 @@ namespace Ink_Canvas.Windows.SettingsViews2
|
|||||||
|
|
||||||
private NavigationViewItem FindNavigationViewItemByTag(string tag)
|
private NavigationViewItem FindNavigationViewItemByTag(string tag)
|
||||||
{
|
{
|
||||||
// 遍历所有菜单项
|
// 遍历所有主菜单项
|
||||||
foreach (var item in NavigationViewControl.MenuItems)
|
foreach (object item in NavigationViewControl.MenuItems)
|
||||||
{
|
{
|
||||||
if (item is NavigationViewItem navItem)
|
if (item is NavigationViewItem navItem)
|
||||||
{
|
{
|
||||||
@@ -167,7 +169,7 @@ namespace Ink_Canvas.Windows.SettingsViews2
|
|||||||
return navItem;
|
return navItem;
|
||||||
}
|
}
|
||||||
// 检查子菜单项
|
// 检查子菜单项
|
||||||
foreach (var child in navItem.MenuItems)
|
foreach (object child in navItem.MenuItems)
|
||||||
{
|
{
|
||||||
if (child is NavigationViewItem childNavItem)
|
if (child is NavigationViewItem childNavItem)
|
||||||
{
|
{
|
||||||
@@ -181,6 +183,17 @@ namespace Ink_Canvas.Windows.SettingsViews2
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 遍历页脚菜单项
|
||||||
|
foreach (object item in NavigationViewControl.FooterMenuItems)
|
||||||
|
{
|
||||||
|
if (item is NavigationViewItem navItem)
|
||||||
|
{
|
||||||
|
if (navItem.Tag as string == tag)
|
||||||
|
{
|
||||||
|
return navItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user