Skip to content

Commit

Permalink
Add settings example project
Browse files Browse the repository at this point in the history
  • Loading branch information
NotYoojun committed Aug 10, 2024
1 parent 728b178 commit 1d9b268
Show file tree
Hide file tree
Showing 18 changed files with 584 additions and 0 deletions.
23 changes: 23 additions & 0 deletions iNKORE.UI.WPF.Modern.sln
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NavigationViewExample", "sa
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Acrylic10Example", "samples\Acrylic10Example\Acrylic10Example.csproj", "{84C80EA6-0F9C-49CF-AB66-5696CC888CA7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SettingsNavigationTest", "samples\SettingsNavigationTest\SettingsNavigationTest.csproj", "{AF682B4E-6A51-474A-8D80-0738A94C72FA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -371,6 +373,26 @@ Global
{84C80EA6-0F9C-49CF-AB66-5696CC888CA7}.Release|x64.Build.0 = Release|Any CPU
{84C80EA6-0F9C-49CF-AB66-5696CC888CA7}.Release|x86.ActiveCfg = Release|Any CPU
{84C80EA6-0F9C-49CF-AB66-5696CC888CA7}.Release|x86.Build.0 = Release|Any CPU
{AF682B4E-6A51-474A-8D80-0738A94C72FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AF682B4E-6A51-474A-8D80-0738A94C72FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AF682B4E-6A51-474A-8D80-0738A94C72FA}.Debug|ARM.ActiveCfg = Debug|Any CPU
{AF682B4E-6A51-474A-8D80-0738A94C72FA}.Debug|ARM.Build.0 = Debug|Any CPU
{AF682B4E-6A51-474A-8D80-0738A94C72FA}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{AF682B4E-6A51-474A-8D80-0738A94C72FA}.Debug|ARM64.Build.0 = Debug|Any CPU
{AF682B4E-6A51-474A-8D80-0738A94C72FA}.Debug|x64.ActiveCfg = Debug|Any CPU
{AF682B4E-6A51-474A-8D80-0738A94C72FA}.Debug|x64.Build.0 = Debug|Any CPU
{AF682B4E-6A51-474A-8D80-0738A94C72FA}.Debug|x86.ActiveCfg = Debug|Any CPU
{AF682B4E-6A51-474A-8D80-0738A94C72FA}.Debug|x86.Build.0 = Debug|Any CPU
{AF682B4E-6A51-474A-8D80-0738A94C72FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AF682B4E-6A51-474A-8D80-0738A94C72FA}.Release|Any CPU.Build.0 = Release|Any CPU
{AF682B4E-6A51-474A-8D80-0738A94C72FA}.Release|ARM.ActiveCfg = Release|Any CPU
{AF682B4E-6A51-474A-8D80-0738A94C72FA}.Release|ARM.Build.0 = Release|Any CPU
{AF682B4E-6A51-474A-8D80-0738A94C72FA}.Release|ARM64.ActiveCfg = Release|Any CPU
{AF682B4E-6A51-474A-8D80-0738A94C72FA}.Release|ARM64.Build.0 = Release|Any CPU
{AF682B4E-6A51-474A-8D80-0738A94C72FA}.Release|x64.ActiveCfg = Release|Any CPU
{AF682B4E-6A51-474A-8D80-0738A94C72FA}.Release|x64.Build.0 = Release|Any CPU
{AF682B4E-6A51-474A-8D80-0738A94C72FA}.Release|x86.ActiveCfg = Release|Any CPU
{AF682B4E-6A51-474A-8D80-0738A94C72FA}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -390,6 +412,7 @@ Global
{194059C8-5CBF-4548-8216-3D251CE43236} = {A96F98E9-18B5-4863-8F28-9B7BDF70A128}
{F9951C10-6C42-4E5F-BAB2-381C17D4DE35} = {A96F98E9-18B5-4863-8F28-9B7BDF70A128}
{84C80EA6-0F9C-49CF-AB66-5696CC888CA7} = {A96F98E9-18B5-4863-8F28-9B7BDF70A128}
{AF682B4E-6A51-474A-8D80-0738A94C72FA} = {A96F98E9-18B5-4863-8F28-9B7BDF70A128}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6251E140-0FAA-4DE9-B245-1C5BE188E578}
Expand Down
1 change: 1 addition & 0 deletions samples/ExamplePhotoTaker/ExamplePhotoTaker.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
<EnableDefaultPageItems>false</EnableDefaultPageItems>
</PropertyGroup>

<ItemGroup>
Expand Down
6 changes: 6 additions & 0 deletions samples/SettingsNavigationTest/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
</configuration>
14 changes: 14 additions & 0 deletions samples/SettingsNavigationTest/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Application x:Class="SettingsNavigationTest.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ui:ThemeResources />
<ui:XamlControlsResources />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
32 changes: 32 additions & 0 deletions samples/SettingsNavigationTest/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;

namespace SettingsNavigationTest
{
/// <summary>
/// App.xaml 的交互逻辑
/// </summary>
public partial class App : Application
{
}
internal static class VisualTreeExtensions
{
public static T TryFindParent<T>(this DependencyObject child) where T : DependencyObject
{
var parent = VisualTreeHelper.GetParent(child);
while (parent != null)
{
if (parent is T parentType) return parentType;
parent = VisualTreeHelper.GetParent(parent);
}

return null;
}
}
}
35 changes: 35 additions & 0 deletions samples/SettingsNavigationTest/AppearancePage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<Page x:Class="SettingsNavigationTest.AppearancePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
Title="DemoPage1">

<Grid>
<ikw:SimpleStackPanel Spacing="10">
<Button Content="Back" Click="BackToMain"/>
<ui:SettingsCard Header="Theme"
Description="Set the theme of this app.">
<ui:SettingsCard.HeaderIcon>
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Color}"/>
</ui:SettingsCard.HeaderIcon>
<ComboBox SelectedIndex="0">
<ComboBoxItem Content="System"/>
<ComboBoxItem Content="Light"/>
<ComboBoxItem Content="Dark"/>
</ComboBox>
</ui:SettingsCard>
<ui:SettingsCard Header="Transparency"
Description="?!">
<ui:SettingsCard.HeaderIcon>
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.AppIconDefault}"/>
</ui:SettingsCard.HeaderIcon>
<ui:ToggleSwitch HorizontalContentAlignment="Right"/>
</ui:SettingsCard>
</ikw:SimpleStackPanel>
</Grid>
</Page>
21 changes: 21 additions & 0 deletions samples/SettingsNavigationTest/AppearancePage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using iNKORE.UI.WPF.Modern.Media.Animation;

namespace SettingsNavigationTest
{
/// <summary>
/// AppearancePage.xaml 的交互逻辑
/// </summary>
public partial class AppearancePage
{
public AppearancePage()
{
InitializeComponent();
}

private void BackToMain(object sender, System.Windows.RoutedEventArgs e)
{
var parent = this.TryFindParent<MainWindow>();
parent.SettingsFrame.Navigate(parent.Main, new SlideNavigationTransitionInfo { Effect = SlideNavigationTransitionEffect.FromLeft });
}
}
}
47 changes: 47 additions & 0 deletions samples/SettingsNavigationTest/MainPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<Page x:Class="SettingsNavigationTest.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
Title="MainPage">

<ikw:SimpleStackPanel Spacing="10">
<ui:SettingsCard Header="App Appearance"
Description="Set the appearance of this app."
IsClickEnabled="True"
Click="ToAppearancePage">
<ui:SettingsCard.HeaderIcon>
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Apps}"/>
</ui:SettingsCard.HeaderIcon>
</ui:SettingsCard>
<ui:SettingsCard Header="Browser Search Engine"
Description="Choose the search engine you like.">
<ui:SettingsCard.HeaderIcon>
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.CloudSearch}"/>
</ui:SettingsCard.HeaderIcon>
<ComboBox SelectedIndex="2">
<ComboBoxItem Content="Baidu"/>
<ComboBoxItem Content="Google"/>
<ComboBoxItem Content="Bing"/>
</ComboBox>
</ui:SettingsCard>
<ui:SettingsCard Header="Sidebar"
Description="Provides many useful tools.">
<ui:SettingsCard.HeaderIcon>
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.ActionCenter}"/>
</ui:SettingsCard.HeaderIcon>
<ui:ToggleSwitch HorizontalContentAlignment="Right"/>
</ui:SettingsCard>
<ui:SettingsCard Header="Check Update"
Description="Current Version: 1.0.0">
<ui:SettingsCard.HeaderIcon>
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Processing}"/>
</ui:SettingsCard.HeaderIcon>
<ui:ToggleSwitch HorizontalContentAlignment="Right"/>
</ui:SettingsCard>
</ikw:SimpleStackPanel>
</Page>
21 changes: 21 additions & 0 deletions samples/SettingsNavigationTest/MainPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using iNKORE.UI.WPF.Modern.Media.Animation;

namespace SettingsNavigationTest
{
/// <summary>
/// MainPage.xaml 的交互逻辑
/// </summary>
public partial class MainPage
{
public MainPage()
{
InitializeComponent();
}

private void ToAppearancePage(object sender, System.Windows.RoutedEventArgs e)
{
var parent = this.TryFindParent<MainWindow>();
parent.SettingsFrame.Navigate(parent.Appearance, new SlideNavigationTransitionInfo { Effect = SlideNavigationTransitionEffect.FromRight });
}
}
}
21 changes: 21 additions & 0 deletions samples/SettingsNavigationTest/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Window x:Class="SettingsNavigationTest.MainWindow"
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"
mc:Ignorable="d"
UseLayoutRounding="True"
ui:ThemeManager.IsThemeAware="True"
ui:WindowHelper.SystemBackdropType="Mica"
ui:WindowHelper.UseModernWindowStyle="True"
Title="SettingsNavigationTest" Height="450" Width="800">
<Grid Margin="25,15,15,15">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Text="Settings" FontSize="28" Grid.Row="0"/>
<ui:Frame x:Name="SettingsFrame" Grid.Row="1" Margin="0,20,0,0"/>
</Grid>
</Window>
20 changes: 20 additions & 0 deletions samples/SettingsNavigationTest/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using iNKORE.UI.WPF.Modern.Media.Animation;
using System.Windows;
using Page = System.Windows.Controls.Page;

namespace SettingsNavigationTest
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow
{
public readonly Page Main = new MainPage();
public readonly Page Appearance = new AppearancePage();
public MainWindow()
{
InitializeComponent();
SettingsFrame.Navigate(Main, new SlideNavigationTransitionInfo { Effect = SlideNavigationTransitionEffect.FromRight });
}
}
}
52 changes: 52 additions & 0 deletions samples/SettingsNavigationTest/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;

// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("SettingsNavigationTest")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SettingsNavigationTest")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]

//若要开始生成可本地化的应用程序,请设置
//.csproj 文件中的 <UICulture>CultureYouAreCodingWith</UICulture>
//在 <PropertyGroup> 中。例如,如果你使用的是美国英语。
//使用的是美国英语,请将 <UICulture> 设置为 en-US。 然后取消
//对以下 NeutralResourceLanguage 特性的注释。 更新
//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。

//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]


[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //主题特定资源词典所处位置
//(未在页面中找到资源时使用,
//或应用程序资源字典中找到时使用)
ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
//(未在页面中找到资源时使用,
//、应用程序或任何主题专用资源字典中找到时使用)
)]


// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Loading

0 comments on commit 1d9b268

Please sign in to comment.