├── .gitignore
├── FDSforCU.sln
├── FDSforCU
├── App.xaml
├── App.xaml.cs
├── Assets
│ ├── AboutBackgroundImage.jpg
│ ├── AcrylicBackgroundImage.jpg
│ ├── Images
│ │ ├── 1.jpg
│ │ ├── 2.jpg
│ │ ├── 3.jpg
│ │ ├── 4.jpg
│ │ └── 5.jpg
│ ├── LockScreenLogo.scale-200.png
│ ├── RevealBackgroundImage.png
│ ├── SplashScreen.scale-200.png
│ ├── Square150x150Logo.scale-200.png
│ ├── Square44x44Logo.scale-200.png
│ ├── Square44x44Logo.targetsize-24_altform-unplated.png
│ ├── StoreLogo.png
│ └── Wide310x150Logo.scale-200.png
├── FDSforCU_TemporaryKey.pfx
├── MainPage.xaml
├── MainPage.xaml.cs
├── Models
│ ├── MainPageModel.cs
│ └── ModelBase.cs
├── Package.appxmanifest
├── Properties
│ ├── AssemblyInfo.cs
│ └── Default.rd.xml
├── README.md
├── Simple.csproj
├── Simple.csproj.user
└── Views
│ ├── AboutPage.xaml
│ ├── AboutPage.xaml.cs
│ ├── AcrylicPage.xaml
│ ├── AcrylicPage.xaml.cs
│ ├── RevealPage.xaml
│ └── RevealPage.xaml.cs
├── FluentDesignSystem
├── Brushes
│ ├── AcrylicBackgroundSource.cs
│ ├── AcrylicBrush.cs
│ ├── RevealBackgroundBrush.cs
│ ├── RevealBorderBrush.cs
│ ├── RevealBrush.cs
│ └── RevealBrushState.cs
├── FluentDesignSystem.csproj
├── Helper
│ ├── RevealBrushHelper.cs
│ └── RevealBrushHelperState.cs
├── Lights
│ ├── RevealAmbientLight.cs
│ ├── RevealBorderSpotLight.cs
│ └── RevealContentSpotLight.cs
├── Properties
│ ├── AssemblyInfo.cs
│ └── FluentDesignSystem.rd.xml
├── ResourceDictionarys
│ ├── Styles.xaml
│ └── ThemeResources.xaml
├── Sketch
│ └── SketchTexture.jpg
└── StaticValue.cs
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | **/obj/
2 | **/bin/
3 | .vs/
4 |
--------------------------------------------------------------------------------
/FDSforCU.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.26730.16
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Simple", "FDSforCU\Simple.csproj", "{612058F8-FA83-4566-BF5E-B512298AB57C}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentDesignSystem", "FluentDesignSystem\FluentDesignSystem.csproj", "{47E75263-FFE8-4C6C-99CF-D847C330076E}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Debug|ARM = Debug|ARM
14 | Debug|x64 = Debug|x64
15 | Debug|x86 = Debug|x86
16 | Release|Any CPU = Release|Any CPU
17 | Release|ARM = Release|ARM
18 | Release|x64 = Release|x64
19 | Release|x86 = Release|x86
20 | EndGlobalSection
21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
22 | {612058F8-FA83-4566-BF5E-B512298AB57C}.Debug|Any CPU.ActiveCfg = Debug|x86
23 | {612058F8-FA83-4566-BF5E-B512298AB57C}.Debug|ARM.ActiveCfg = Debug|ARM
24 | {612058F8-FA83-4566-BF5E-B512298AB57C}.Debug|ARM.Build.0 = Debug|ARM
25 | {612058F8-FA83-4566-BF5E-B512298AB57C}.Debug|ARM.Deploy.0 = Debug|ARM
26 | {612058F8-FA83-4566-BF5E-B512298AB57C}.Debug|x64.ActiveCfg = Debug|x64
27 | {612058F8-FA83-4566-BF5E-B512298AB57C}.Debug|x64.Build.0 = Debug|x64
28 | {612058F8-FA83-4566-BF5E-B512298AB57C}.Debug|x64.Deploy.0 = Debug|x64
29 | {612058F8-FA83-4566-BF5E-B512298AB57C}.Debug|x86.ActiveCfg = Debug|x86
30 | {612058F8-FA83-4566-BF5E-B512298AB57C}.Debug|x86.Build.0 = Debug|x86
31 | {612058F8-FA83-4566-BF5E-B512298AB57C}.Debug|x86.Deploy.0 = Debug|x86
32 | {612058F8-FA83-4566-BF5E-B512298AB57C}.Release|Any CPU.ActiveCfg = Release|x86
33 | {612058F8-FA83-4566-BF5E-B512298AB57C}.Release|ARM.ActiveCfg = Release|ARM
34 | {612058F8-FA83-4566-BF5E-B512298AB57C}.Release|ARM.Build.0 = Release|ARM
35 | {612058F8-FA83-4566-BF5E-B512298AB57C}.Release|ARM.Deploy.0 = Release|ARM
36 | {612058F8-FA83-4566-BF5E-B512298AB57C}.Release|x64.ActiveCfg = Release|x64
37 | {612058F8-FA83-4566-BF5E-B512298AB57C}.Release|x64.Build.0 = Release|x64
38 | {612058F8-FA83-4566-BF5E-B512298AB57C}.Release|x64.Deploy.0 = Release|x64
39 | {612058F8-FA83-4566-BF5E-B512298AB57C}.Release|x86.ActiveCfg = Release|x86
40 | {612058F8-FA83-4566-BF5E-B512298AB57C}.Release|x86.Build.0 = Release|x86
41 | {612058F8-FA83-4566-BF5E-B512298AB57C}.Release|x86.Deploy.0 = Release|x86
42 | {47E75263-FFE8-4C6C-99CF-D847C330076E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
43 | {47E75263-FFE8-4C6C-99CF-D847C330076E}.Debug|Any CPU.Build.0 = Debug|Any CPU
44 | {47E75263-FFE8-4C6C-99CF-D847C330076E}.Debug|ARM.ActiveCfg = Debug|ARM
45 | {47E75263-FFE8-4C6C-99CF-D847C330076E}.Debug|ARM.Build.0 = Debug|ARM
46 | {47E75263-FFE8-4C6C-99CF-D847C330076E}.Debug|x64.ActiveCfg = Debug|x64
47 | {47E75263-FFE8-4C6C-99CF-D847C330076E}.Debug|x64.Build.0 = Debug|x64
48 | {47E75263-FFE8-4C6C-99CF-D847C330076E}.Debug|x86.ActiveCfg = Debug|x86
49 | {47E75263-FFE8-4C6C-99CF-D847C330076E}.Debug|x86.Build.0 = Debug|x86
50 | {47E75263-FFE8-4C6C-99CF-D847C330076E}.Release|Any CPU.ActiveCfg = Release|Any CPU
51 | {47E75263-FFE8-4C6C-99CF-D847C330076E}.Release|Any CPU.Build.0 = Release|Any CPU
52 | {47E75263-FFE8-4C6C-99CF-D847C330076E}.Release|ARM.ActiveCfg = Release|ARM
53 | {47E75263-FFE8-4C6C-99CF-D847C330076E}.Release|ARM.Build.0 = Release|ARM
54 | {47E75263-FFE8-4C6C-99CF-D847C330076E}.Release|x64.ActiveCfg = Release|x64
55 | {47E75263-FFE8-4C6C-99CF-D847C330076E}.Release|x64.Build.0 = Release|x64
56 | {47E75263-FFE8-4C6C-99CF-D847C330076E}.Release|x86.ActiveCfg = Release|x86
57 | {47E75263-FFE8-4C6C-99CF-D847C330076E}.Release|x86.Build.0 = Release|x86
58 | EndGlobalSection
59 | GlobalSection(SolutionProperties) = preSolution
60 | HideSolutionNode = FALSE
61 | EndGlobalSection
62 | GlobalSection(ExtensibilityGlobals) = postSolution
63 | SolutionGuid = {C8675F5E-A568-4131-910C-B847E4538345}
64 | EndGlobalSection
65 | EndGlobal
66 |
--------------------------------------------------------------------------------
/FDSforCU/App.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/FDSforCU/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Runtime.InteropServices.WindowsRuntime;
6 | using Windows.ApplicationModel;
7 | using Windows.ApplicationModel.Activation;
8 | using Windows.Foundation;
9 | using Windows.Foundation.Collections;
10 | using Windows.UI.Xaml;
11 | using Windows.UI.Xaml.Controls;
12 | using Windows.UI.Xaml.Controls.Primitives;
13 | using Windows.UI.Xaml.Data;
14 | using Windows.UI.Xaml.Input;
15 | using Windows.UI.Xaml.Media;
16 | using Windows.UI.Xaml.Navigation;
17 |
18 | namespace FDSforCU
19 | {
20 | ///
21 | /// 提供特定于应用程序的行为,以补充默认的应用程序类。
22 | ///
23 | sealed partial class App : Application
24 | {
25 | ///
26 | /// 初始化单一实例应用程序对象。这是执行的创作代码的第一行,
27 | /// 已执行,逻辑上等同于 main() 或 WinMain()。
28 | ///
29 | public App()
30 | {
31 | this.InitializeComponent();
32 | this.Suspending += OnSuspending;
33 | }
34 |
35 | ///
36 | /// 在应用程序由最终用户正常启动时进行调用。
37 | /// 将在启动应用程序以打开特定文件等情况下使用。
38 | ///
39 | /// 有关启动请求和过程的详细信息。
40 | protected override void OnLaunched(LaunchActivatedEventArgs e)
41 | {
42 | Frame rootFrame = Window.Current.Content as Frame;
43 |
44 | // 不要在窗口已包含内容时重复应用程序初始化,
45 | // 只需确保窗口处于活动状态
46 | if (rootFrame == null)
47 | {
48 | // 创建要充当导航上下文的框架,并导航到第一页
49 | rootFrame = new Frame();
50 |
51 | rootFrame.NavigationFailed += OnNavigationFailed;
52 |
53 | if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
54 | {
55 | //TODO: 从之前挂起的应用程序加载状态
56 | }
57 |
58 | // 将框架放在当前窗口中
59 | Window.Current.Content = rootFrame;
60 | }
61 |
62 | if (e.PrelaunchActivated == false)
63 | {
64 | if (rootFrame.Content == null)
65 | {
66 | // 当导航堆栈尚未还原时,导航到第一页,
67 | // 并通过将所需信息作为导航参数传入来配置
68 | // 参数
69 | rootFrame.Navigate(typeof(MainPage), e.Arguments);
70 | }
71 | // 确保当前窗口处于活动状态
72 | Window.Current.Activate();
73 | }
74 | }
75 |
76 | ///
77 | /// 导航到特定页失败时调用
78 | ///
79 | ///导航失败的框架
80 | ///有关导航失败的详细信息
81 | void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
82 | {
83 | throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
84 | }
85 |
86 | ///
87 | /// 在将要挂起应用程序执行时调用。 在不知道应用程序
88 | /// 无需知道应用程序会被终止还是会恢复,
89 | /// 并让内存内容保持不变。
90 | ///
91 | /// 挂起的请求的源。
92 | /// 有关挂起请求的详细信息。
93 | private void OnSuspending(object sender, SuspendingEventArgs e)
94 | {
95 | var deferral = e.SuspendingOperation.GetDeferral();
96 | //TODO: 保存应用程序状态并停止任何后台活动
97 | deferral.Complete();
98 | }
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/FDSforCU/Assets/AboutBackgroundImage.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnbluefire/FDSforCU/07e13555787bf4f80805d25e5a66d6d7e7487199/FDSforCU/Assets/AboutBackgroundImage.jpg
--------------------------------------------------------------------------------
/FDSforCU/Assets/AcrylicBackgroundImage.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnbluefire/FDSforCU/07e13555787bf4f80805d25e5a66d6d7e7487199/FDSforCU/Assets/AcrylicBackgroundImage.jpg
--------------------------------------------------------------------------------
/FDSforCU/Assets/Images/1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnbluefire/FDSforCU/07e13555787bf4f80805d25e5a66d6d7e7487199/FDSforCU/Assets/Images/1.jpg
--------------------------------------------------------------------------------
/FDSforCU/Assets/Images/2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnbluefire/FDSforCU/07e13555787bf4f80805d25e5a66d6d7e7487199/FDSforCU/Assets/Images/2.jpg
--------------------------------------------------------------------------------
/FDSforCU/Assets/Images/3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnbluefire/FDSforCU/07e13555787bf4f80805d25e5a66d6d7e7487199/FDSforCU/Assets/Images/3.jpg
--------------------------------------------------------------------------------
/FDSforCU/Assets/Images/4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnbluefire/FDSforCU/07e13555787bf4f80805d25e5a66d6d7e7487199/FDSforCU/Assets/Images/4.jpg
--------------------------------------------------------------------------------
/FDSforCU/Assets/Images/5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnbluefire/FDSforCU/07e13555787bf4f80805d25e5a66d6d7e7487199/FDSforCU/Assets/Images/5.jpg
--------------------------------------------------------------------------------
/FDSforCU/Assets/LockScreenLogo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnbluefire/FDSforCU/07e13555787bf4f80805d25e5a66d6d7e7487199/FDSforCU/Assets/LockScreenLogo.scale-200.png
--------------------------------------------------------------------------------
/FDSforCU/Assets/RevealBackgroundImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnbluefire/FDSforCU/07e13555787bf4f80805d25e5a66d6d7e7487199/FDSforCU/Assets/RevealBackgroundImage.png
--------------------------------------------------------------------------------
/FDSforCU/Assets/SplashScreen.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnbluefire/FDSforCU/07e13555787bf4f80805d25e5a66d6d7e7487199/FDSforCU/Assets/SplashScreen.scale-200.png
--------------------------------------------------------------------------------
/FDSforCU/Assets/Square150x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnbluefire/FDSforCU/07e13555787bf4f80805d25e5a66d6d7e7487199/FDSforCU/Assets/Square150x150Logo.scale-200.png
--------------------------------------------------------------------------------
/FDSforCU/Assets/Square44x44Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnbluefire/FDSforCU/07e13555787bf4f80805d25e5a66d6d7e7487199/FDSforCU/Assets/Square44x44Logo.scale-200.png
--------------------------------------------------------------------------------
/FDSforCU/Assets/Square44x44Logo.targetsize-24_altform-unplated.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnbluefire/FDSforCU/07e13555787bf4f80805d25e5a66d6d7e7487199/FDSforCU/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
--------------------------------------------------------------------------------
/FDSforCU/Assets/StoreLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnbluefire/FDSforCU/07e13555787bf4f80805d25e5a66d6d7e7487199/FDSforCU/Assets/StoreLogo.png
--------------------------------------------------------------------------------
/FDSforCU/Assets/Wide310x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnbluefire/FDSforCU/07e13555787bf4f80805d25e5a66d6d7e7487199/FDSforCU/Assets/Wide310x150Logo.scale-200.png
--------------------------------------------------------------------------------
/FDSforCU/FDSforCU_TemporaryKey.pfx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnbluefire/FDSforCU/07e13555787bf4f80805d25e5a66d6d7e7487199/FDSforCU/FDSforCU_TemporaryKey.pfx
--------------------------------------------------------------------------------
/FDSforCU/MainPage.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
74 |
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/FDSforCU/MainPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using FDSforCU.Models;
2 | using FDSforCU.Views;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Collections.ObjectModel;
6 | using System.IO;
7 | using System.Linq;
8 | using System.Runtime.InteropServices.WindowsRuntime;
9 | using Windows.ApplicationModel.Core;
10 | using Windows.Foundation;
11 | using Windows.Foundation.Collections;
12 | using Windows.UI;
13 | using Windows.UI.ViewManagement;
14 | using Windows.UI.Xaml;
15 | using Windows.UI.Xaml.Controls;
16 | using Windows.UI.Xaml.Controls.Primitives;
17 | using Windows.UI.Xaml.Data;
18 | using Windows.UI.Xaml.Input;
19 | using Windows.UI.Xaml.Media;
20 | using Windows.UI.Xaml.Navigation;
21 |
22 | // https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x804 上介绍了“空白页”项模板
23 |
24 | namespace FDSforCU
25 | {
26 | ///
27 | /// 可用于自身或导航至 Frame 内部的空白页。
28 | ///
29 | public sealed partial class MainPage : Page
30 | {
31 | public MainPage()
32 | {
33 | this.InitializeComponent();
34 | HamburgerMenuList.Add(new MainPageModel() { Title = "亚克力笔刷", PageType = typeof(AcrylicPage) });
35 | HamburgerMenuList.Add(new MainPageModel() { Title = "展示效果", PageType = typeof(RevealPage) });
36 | ButtomMenuList.Add(new MainPageModel() { Title = "关于", PageType = typeof(AboutPage) });
37 | selectedModel = new MainPageModel();
38 |
39 | }
40 | MainPageModel selectedModel;
41 | ObservableCollection HamburgerMenuList = new ObservableCollection();
42 | ObservableCollection ButtomMenuList = new ObservableCollection();
43 |
44 | private void HamburgerIconButton_Click(object sender, RoutedEventArgs e)
45 | {
46 | rootSplitView.IsPaneOpen = !rootSplitView.IsPaneOpen;
47 | }
48 |
49 | private void HamburgerMenu_SelectionChanged(object sender, SelectionChangedEventArgs e)
50 | {
51 | if (sender is ListView listView)
52 | {
53 | if (listView.SelectedIndex == -1) return;
54 | if (listView == HamburgerMenu)
55 | {
56 | ButtomMenu.SelectedIndex = -1;
57 | }
58 | else if (listView == ButtomMenu)
59 | {
60 | HamburgerMenu.SelectedIndex = -1;
61 | }
62 | var item = listView.SelectedItem as MainPageModel;
63 | selectedModel.Title = item.Title;
64 | selectedModel.PageType = item.PageType;
65 | ContentFrame.Navigate(selectedModel.PageType);
66 | }
67 |
68 | }
69 |
70 | private async void HamburgerMenu_Loaded(object sender, RoutedEventArgs e)
71 | {
72 | if (sender is ListView listView)
73 | {
74 | await listView.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High, () => listView.SelectedIndex = 0);
75 | }
76 | }
77 |
78 | private void TitleGrid_Loaded(object sender, RoutedEventArgs e)
79 | {
80 | if(Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily == "Windows.Desktop")
81 | {
82 | CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
83 | ApplicationViewTitleBar titleBar = ApplicationView.GetForCurrentView().TitleBar;
84 | titleBar.ButtonBackgroundColor = Colors.Transparent;
85 | titleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
86 | }
87 | else
88 | {
89 | TitleGrid.Visibility = Visibility.Collapsed;
90 | }
91 | }
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/FDSforCU/Models/MainPageModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace FDSforCU.Models
8 | {
9 | public class MainPageModel : ModelBase
10 | {
11 | private Type _PageType;
12 | private string _Title;
13 |
14 | public Type PageType
15 | {
16 | get => _PageType;
17 | set
18 | {
19 | _PageType = value;
20 | NotifyPropertyChanged();
21 | }
22 | }
23 | public string Title
24 | {
25 | get => _Title;
26 | set
27 | {
28 | _Title = value;
29 | NotifyPropertyChanged();
30 | }
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/FDSforCU/Models/ModelBase.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Linq;
5 | using System.Runtime.CompilerServices;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace FDSforCU.Models
10 | {
11 | public class ModelBase : INotifyPropertyChanged
12 | {
13 | public event PropertyChangedEventHandler PropertyChanged;
14 | protected virtual void NotifyPropertyChanged([CallerMemberName]string propName = "")
15 | {
16 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propName));
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/FDSforCU/Package.appxmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
13 |
14 |
15 |
16 |
17 | FDSforCU
18 | blue-
19 | Assets\StoreLogo.png
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
34 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/FDSforCU/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("FDSforCU Simple")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("FDSforCU")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Version information for an assembly consists of the following four values:
18 | //
19 | // Major Version
20 | // Minor Version
21 | // Build Number
22 | // Revision
23 | //
24 | // You can specify all the values or you can default the Build and Revision Numbers
25 | // by using the '*' as shown below:
26 | // [assembly: AssemblyVersion("1.0.*")]
27 | [assembly: AssemblyVersion("0.1.0.0")]
28 | [assembly: AssemblyFileVersion("0.1.0.0")]
29 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/FDSforCU/Properties/Default.rd.xml:
--------------------------------------------------------------------------------
1 |
17 |
18 |
19 |
20 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/FDSforCU/README.md:
--------------------------------------------------------------------------------
1 | Fluent Design System for Creators Update V0.2
2 | ==============
3 | Fluent Design System for Creators Update(FDS4CU)是一个UWP的资源库,将Windows10 Fall Creators Update(10.0;版本16299)SDK中的部分效果(Acrylic和Reveal)移植到Windows10 15063中。
4 | 目前支持全部的Acrylic笔刷和Button,ToggleButton,RepeatButton,SemanticZoom,AutoSuggestBox,ComboBox,ListView和GridView的Reveal效果。
5 |
6 | Acrylic笔刷如下(详细参数可见/ResourceDictionarys/ThemeResources.xaml):
7 |
8 | SystemControlAcrylicWindowBrush
9 | SystemControlAcrylicElementBrush
10 | SystemControlAccentAcrylicWindowAccentMediumHighBrush
11 | SystemControlAccentAcrylicElementAccentMediumHighBrush
12 | SystemControlAccentDark1AcrylicWindowAccentDark1Brush
13 | SystemControlAccentDark1AcrylicElementAccentDark1Brush
14 | SystemControlAccentDark2AcrylicWindowAccentDark2MediumHighBrush
15 | SystemControlAccentDark2AcrylicElementAccentDark2MediumHighBrush
16 | SystemControlAcrylicWindowMediumHighBrush
17 | SystemControlAcrylicElementMediumHighBrush
18 | SystemControlAcrylicWindowMediumBrush
19 | SystemControlAcrylicElementMediumBrush
20 | SystemControlChromeMediumLowAcrylicWindowMediumBrush
21 | SystemControlChromeMediumLowAcrylicElementMediumBrush
22 | SystemControlBaseHighAcrylicWindowBrush
23 | SystemControlBaseHighAcrylicElementBrush
24 | SystemControlBaseHighAcrylicWindowMediumHighBrush
25 | SystemControlBaseHighAcrylicElementMediumHighBrush
26 | SystemControlBaseHighAcrylicWindowMediumBrush
27 | SystemControlBaseHighAcrylicElementMediumBrush
28 | SystemControlChromeLowAcrylicWindowBrush
29 | SystemControlChromeLowAcrylicElementBrush
30 | SystemControlChromeMediumAcrylicWindowMediumBrush
31 | SystemControlChromeMediumAcrylicElementMediumBrush
32 | SystemControlChromeHighAcrylicWindowMediumBrush
33 | SystemControlChromeHighAcrylicElementMediumBrush
34 | SystemControlBaseLowAcrylicWindowBrush
35 | SystemControlBaseLowAcrylicElementBrush
36 | SystemControlBaseMediumLowAcrylicWindowMediumBrush
37 | SystemControlBaseMediumLowAcrylicElementMediumBrush
38 | SystemControlAltLowAcrylicWindowBrush
39 | SystemControlAltLowAcrylicElementBrush
40 | SystemControlAltMediumLowAcrylicWindowMediumBrush
41 | SystemControlAltMediumLowAcrylicElementMediumBrush
42 | SystemControlAltHighAcrylicWindowBrush
43 | SystemControlAltHighAcrylicElementBrush
44 |
45 | 开启Acrylic的方法如下:
46 | 在App.xaml中添加:
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 | 引入相关资源字典即可使用所有笔刷。
57 |
58 | ***
59 |
60 | Reveal样式如下(详细参数可见/ResourceDictionarys/Styles.xaml,AutoSuggestBox,ComboBox,ListView和GridView不需多做处理,其他需要设置Style="...RevealStyle"):
61 |
62 | ButtonRevealStyle
63 | RepeatButtonRevealStyle
64 | ToggleButtonRevealStyle
65 | SemanticZoomRevealStyle
66 | AutoSuggestBoxRevealStyle
67 | ComboBoxItemRevealStyle
68 | ListViewItemRevealStyle
69 | GridViewItemRevealStyle
70 |
71 | 自定义控件开启Reveal方式如下:
72 | 首先同上引入资源字典,然后编辑UserControl的VisualState:
73 |
74 |
77 |
78 |
79 |
80 | VisualState x:Name="Normal" />
81 |
82 |
83 |
84 |
89 |
90 |
91 |
92 |
93 |
97 |
98 |
99 |
100 | ...
101 |
102 |
103 | 然后在后台代码中处理VisualState状态转换。
104 |
105 | ***
106 |
107 | 由于SDK接口的局限性,还有一些实现上的问题,Acrylic和Reveal表现并不是太稳定,欢迎大家Fork和反馈。
108 |
109 | By:叫我蓝火火
110 | Blog:[叫我蓝火火](http://www.cnblogs.com/blue-fire/)
111 | 微博:[Blue_Fire蓝火](http://www.weibo.com/2255001067/profile)
--------------------------------------------------------------------------------
/FDSforCU/Simple.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | x86
7 | {612058F8-FA83-4566-BF5E-B512298AB57C}
8 | AppContainerExe
9 | Properties
10 | FDSforCU
11 | FDSforCU
12 | zh-CN
13 | UAP
14 | 10.0.15063.0
15 | 10.0.15063.0
16 | 14
17 | 512
18 | {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
19 | true
20 | FDSforCU_TemporaryKey.pfx
21 |
22 |
23 | true
24 | bin\x86\Debug\
25 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
26 | ;2008
27 | full
28 | x86
29 | false
30 | prompt
31 | true
32 |
33 |
34 | bin\x86\Release\
35 | TRACE;NETFX_CORE;WINDOWS_UWP
36 | true
37 | ;2008
38 | pdbonly
39 | x86
40 | false
41 | prompt
42 | true
43 | true
44 |
45 |
46 | true
47 | bin\ARM\Debug\
48 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
49 | ;2008
50 | full
51 | ARM
52 | false
53 | prompt
54 | true
55 |
56 |
57 | bin\ARM\Release\
58 | TRACE;NETFX_CORE;WINDOWS_UWP
59 | true
60 | ;2008
61 | pdbonly
62 | ARM
63 | false
64 | prompt
65 | true
66 | true
67 |
68 |
69 | true
70 | bin\x64\Debug\
71 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
72 | ;2008
73 | full
74 | x64
75 | false
76 | prompt
77 | true
78 |
79 |
80 | bin\x64\Release\
81 | TRACE;NETFX_CORE;WINDOWS_UWP
82 | true
83 | ;2008
84 | pdbonly
85 | x64
86 | false
87 | prompt
88 | true
89 | true
90 |
91 |
92 | PackageReference
93 |
94 |
95 |
96 | App.xaml
97 |
98 |
99 | MainPage.xaml
100 |
101 |
102 |
103 |
104 |
105 | AboutPage.xaml
106 |
107 |
108 | AcrylicPage.xaml
109 |
110 |
111 | RevealPage.xaml
112 |
113 |
114 |
115 |
116 | Designer
117 |
118 |
119 |
120 |
121 | PreserveNewest
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 | MSBuild:Compile
144 | Designer
145 |
146 |
147 | MSBuild:Compile
148 | Designer
149 |
150 |
151 | Designer
152 | MSBuild:Compile
153 |
154 |
155 | Designer
156 | MSBuild:Compile
157 |
158 |
159 | Designer
160 | MSBuild:Compile
161 |
162 |
163 |
164 |
165 | 5.4.0
166 |
167 |
168 | 2.0.0
169 |
170 |
171 |
172 |
173 | {47e75263-ffe8-4c6c-99cf-d847c330076e}
174 | FluentDesignSystem
175 |
176 |
177 |
178 | 14.0
179 |
180 |
181 |
188 |
--------------------------------------------------------------------------------
/FDSforCU/Simple.csproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 30F105C9-681E-420b-A277-7C086EAD8A4E
5 | true
6 |
7 |
--------------------------------------------------------------------------------
/FDSforCU/Views/AboutPage.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/FDSforCU/Views/AboutPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using FDSforCU.Models;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Runtime.InteropServices.WindowsRuntime;
7 | using Windows.Foundation;
8 | using Windows.Foundation.Collections;
9 | using Windows.Storage;
10 | using Windows.System;
11 | using Windows.UI.Xaml;
12 | using Windows.UI.Xaml.Controls;
13 | using Windows.UI.Xaml.Controls.Primitives;
14 | using Windows.UI.Xaml.Data;
15 | using Windows.UI.Xaml.Hosting;
16 | using Windows.UI.Xaml.Input;
17 | using Windows.UI.Xaml.Media;
18 | using Windows.UI.Xaml.Navigation;
19 |
20 | // https://go.microsoft.com/fwlink/?LinkId=234238 上介绍了“空白页”项模板
21 |
22 | namespace FDSforCU.Views
23 | {
24 | ///
25 | /// 可用于自身或导航至 Frame 内部的空白页。
26 | ///
27 | public sealed partial class AboutPage : Page
28 | {
29 | public AboutPage()
30 | {
31 | this.InitializeComponent();
32 | MDsource = new MainPageModel();
33 | }
34 |
35 | MainPageModel MDsource;
36 |
37 |
38 | private async void MarkdownTextBlock_LinkClicked(object sender, Microsoft.Toolkit.Uwp.UI.Controls.LinkClickedEventArgs e)
39 | {
40 | await Launcher.LaunchUriAsync(new Uri(e.Link));
41 | }
42 |
43 | private async void rootScrollViewer_Loaded(object sender, RoutedEventArgs e)
44 | {
45 | var file = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///README.md"));
46 | using (var stream = await file.OpenStreamForReadAsync())
47 | {
48 | using (var reader = new StreamReader(stream))
49 | {
50 | MDsource.Title = await reader.ReadToEndAsync();
51 | }
52 | }
53 |
54 | var pVisual = ElementCompositionPreview.GetElementVisual(BackgroundImage);
55 | var mVisual = ElementCompositionPreview.GetElementVisual(mainStackPanel);
56 |
57 | var sPropSet = ElementCompositionPreview.GetScrollViewerManipulationPropertySet(sender as ScrollViewer);
58 |
59 | var compositor = ElementCompositionPreview.GetElementVisual(Window.Current.Content).Compositor;
60 | var pAnimation = compositor.CreateExpressionAnimation("Matrix4x4.CreateFromTranslation(Vector3(sPropSet.Translation.X ,-0.2 * mVisual.Size.Y -0.6 * sPropSet.Translation.Y , 0.0f))");
61 | pAnimation.SetReferenceParameter("sPropSet", sPropSet);
62 | pAnimation.SetReferenceParameter("mVisual", mVisual);
63 | pVisual.StartAnimation("TransformMatrix", pAnimation);
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/FDSforCU/Views/AcrylicPage.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
23 |
28 |
33 |
38 |
43 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
--------------------------------------------------------------------------------
/FDSforCU/Views/AcrylicPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Runtime.InteropServices.WindowsRuntime;
6 | using Windows.Foundation;
7 | using Windows.Foundation.Collections;
8 | using Windows.UI.Xaml;
9 | using Windows.UI.Xaml.Controls;
10 | using Windows.UI.Xaml.Controls.Primitives;
11 | using Windows.UI.Xaml.Data;
12 | using Windows.UI.Xaml.Hosting;
13 | using Windows.UI.Xaml.Input;
14 | using Windows.UI.Xaml.Media;
15 | using Windows.UI.Xaml.Navigation;
16 |
17 | // https://go.microsoft.com/fwlink/?LinkId=234238 上介绍了“空白页”项模板
18 |
19 | namespace FDSforCU.Views
20 | {
21 | ///
22 | /// 可用于自身或导航至 Frame 内部的空白页。
23 | ///
24 | public sealed partial class AcrylicPage : Page
25 | {
26 | public AcrylicPage()
27 | {
28 | this.InitializeComponent();
29 | }
30 |
31 | private void ToggleSwitch_Loaded(object sender, RoutedEventArgs e)
32 | {
33 | if (sender is ToggleSwitch tSwitch)
34 | {
35 | if (this.RequestedTheme == ElementTheme.Light) tSwitch.IsOn = true;
36 | else tSwitch.IsOn = false;
37 | }
38 | }
39 |
40 | private void ToggleSwitch_Toggled(object sender, RoutedEventArgs e)
41 | {
42 | if (sender is ToggleSwitch tSwitch)
43 | {
44 | if (tSwitch.IsOn) this.RequestedTheme = ElementTheme.Light;
45 | else this.RequestedTheme = ElementTheme.Dark;
46 | }
47 | }
48 |
49 | private void AcrylicTopGrid_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
50 | {
51 | var trans = AcrylicTopGrid.RenderTransform as TranslateTransform;
52 | var temp = trans.Y + e.Delta.Translation.Y;
53 | if (temp < 0 && temp > -AcrylicTopGrid.ActualHeight)
54 | {
55 | trans.Y = temp;
56 | }
57 | }
58 |
59 | private void AcrylicTopGrid_ManipulationStarting(object sender, ManipulationStartingRoutedEventArgs e)
60 | {
61 | RectToButtom.SkipToFill();
62 | }
63 |
64 | private void AcrylicTopGrid_ManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e)
65 | {
66 | RectToButtom.Begin();
67 | }
68 |
69 | private void Grid_SizeChanged(object sender, SizeChangedEventArgs e)
70 | {
71 | ElementBrushGridClip.Rect = new Rect(new Point(0, 0), e.NewSize);
72 | }
73 |
74 | private void AcrylicTopGrid_Tapped(object sender, TappedRoutedEventArgs e)
75 | {
76 | var trans = AcrylicTopGrid.RenderTransform as TranslateTransform;
77 | if (trans.Y == 0)
78 | RectToJump.Begin();
79 | }
80 |
81 | private void rootScrollViewer_Loaded(object sender, RoutedEventArgs e)
82 | {
83 | var pVisual = ElementCompositionPreview.GetElementVisual(BackgroundImage);
84 | var mVisual = ElementCompositionPreview.GetElementVisual(mainStackPanel);
85 |
86 | var sPropSet = ElementCompositionPreview.GetScrollViewerManipulationPropertySet(sender as ScrollViewer);
87 |
88 | var compositor = ElementCompositionPreview.GetElementVisual(Window.Current.Content).Compositor;
89 | var pAnimation = compositor.CreateExpressionAnimation("Matrix4x4.CreateFromTranslation(Vector3(sPropSet.Translation.X ,-0.2 * mVisual.Size.Y -0.6 * sPropSet.Translation.Y , 0.0f))");
90 | pAnimation.SetReferenceParameter("sPropSet", sPropSet);
91 | pAnimation.SetReferenceParameter("mVisual", mVisual);
92 | pVisual.StartAnimation("TransformMatrix", pAnimation);
93 | }
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/FDSforCU/Views/RevealPage.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/FDSforCU/Views/RevealPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Collections.ObjectModel;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Runtime.InteropServices.WindowsRuntime;
7 | using Windows.Foundation;
8 | using Windows.Foundation.Collections;
9 | using Windows.UI.Xaml;
10 | using Windows.UI.Xaml.Controls;
11 | using Windows.UI.Xaml.Controls.Primitives;
12 | using Windows.UI.Xaml.Data;
13 | using Windows.UI.Xaml.Hosting;
14 | using Windows.UI.Xaml.Input;
15 | using Windows.UI.Xaml.Media;
16 | using Windows.UI.Xaml.Navigation;
17 |
18 | // https://go.microsoft.com/fwlink/?LinkId=234238 上介绍了“空白页”项模板
19 |
20 | namespace FDSforCU.Views
21 | {
22 | ///
23 | /// 可用于自身或导航至 Frame 内部的空白页。
24 | ///
25 | public sealed partial class RevealPage : Page
26 | {
27 | public RevealPage()
28 | {
29 | this.InitializeComponent();
30 | Lists = new ObservableCollection();
31 | Lists.Add(new Uri("ms-appx:///Assets/Images/1.jpg"));
32 | Lists.Add(new Uri("ms-appx:///Assets/Images/2.jpg"));
33 | Lists.Add(new Uri("ms-appx:///Assets/Images/3.jpg"));
34 | Lists.Add(new Uri("ms-appx:///Assets/Images/4.jpg"));
35 | Lists.Add(new Uri("ms-appx:///Assets/Images/5.jpg"));
36 | Suggestions = new ObservableCollection();
37 | }
38 |
39 | public ObservableCollection Lists { get; private set; }
40 | public ObservableCollection Suggestions { get; private set; }
41 |
42 | private void ToggleSwitch_Loaded(object sender, RoutedEventArgs e)
43 | {
44 | if (sender is ToggleSwitch tSwitch)
45 | {
46 | if (this.RequestedTheme == ElementTheme.Light) tSwitch.IsOn = true;
47 | else tSwitch.IsOn = false;
48 | }
49 | }
50 |
51 | private void ToggleSwitch_Toggled(object sender, RoutedEventArgs e)
52 | {
53 | if (sender is ToggleSwitch tSwitch)
54 | {
55 | if (tSwitch.IsOn) this.RequestedTheme = ElementTheme.Light;
56 | else this.RequestedTheme = ElementTheme.Dark;
57 | }
58 | }
59 |
60 | private void rootScrollViewer_Loaded(object sender, RoutedEventArgs e)
61 | {
62 | var pVisual = ElementCompositionPreview.GetElementVisual(BackgroundImage);
63 | var mVisual = ElementCompositionPreview.GetElementVisual(mainStackPanel);
64 |
65 | var sPropSet = ElementCompositionPreview.GetScrollViewerManipulationPropertySet(sender as ScrollViewer);
66 |
67 | var compositor = ElementCompositionPreview.GetElementVisual(Window.Current.Content).Compositor;
68 | var pAnimation = compositor.CreateExpressionAnimation("Matrix4x4.CreateFromTranslation(Vector3(sPropSet.Translation.X ,-0.1 * mVisual.Size.Y -0.6 * sPropSet.Translation.Y , 0.0f))");
69 | pAnimation.SetReferenceParameter("sPropSet", sPropSet);
70 | pAnimation.SetReferenceParameter("mVisual", mVisual);
71 | pVisual.StartAnimation("TransformMatrix", pAnimation);
72 | }
73 |
74 | private void autoSuggestBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
75 | {
76 | if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
77 | {
78 | Suggestions.Clear();
79 | foreach(var item in Lists)
80 | {
81 | if (item.ToString().Contains(sender.Text))
82 | Suggestions.Add(item.ToString());
83 | }
84 | sender.ItemsSource = Suggestions;
85 | }
86 | }
87 |
88 | private void autoSuggestBox_SuggestionChosen(AutoSuggestBox sender, AutoSuggestBoxSuggestionChosenEventArgs args)
89 | {
90 | foreach (var item in Lists)
91 | {
92 | if (item.ToString() == args.SelectedItem.ToString())
93 | comboBox.SelectedItem = item;
94 | }
95 | }
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/FluentDesignSystem/Brushes/AcrylicBackgroundSource.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace FluentDesignSystem.Brushes
8 | {
9 | public enum AcrylicBackgroundSource
10 | {
11 | Backdrop, Hostbackdrop
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/FluentDesignSystem/Brushes/AcrylicBrush.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Graphics.Canvas;
2 | using Microsoft.Graphics.Canvas.Effects;
3 | using Microsoft.Graphics.Canvas.UI.Composition;
4 | using System;
5 | using System.Collections.Generic;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using Windows.ApplicationModel;
10 | using Windows.Foundation;
11 | using Windows.UI;
12 | using Windows.UI.Composition;
13 | using Windows.UI.Core;
14 | using Windows.UI.Xaml;
15 | using Windows.UI.Xaml.Hosting;
16 | using Windows.UI.Xaml.Media;
17 |
18 | namespace FluentDesignSystem.Brushes
19 | {
20 | public class AcrylicBrush : XamlCompositionBrushBase
21 | {
22 | Compositor compositor;
23 | CompositionEffectBrush Brush;
24 | ScalarKeyFrameAnimation TintOpacityFillAnimation;
25 | ScalarKeyFrameAnimation HostOpacityZeroAnimation;
26 | ColorKeyFrameAnimation TintToFallBackAnimation;
27 |
28 | protected override void OnConnected()
29 | {
30 | if (DesignMode.DesignModeEnabled) return;
31 | compositor = ElementCompositionPreview.GetElementVisual(Window.Current.Content as UIElement).Compositor;
32 | var tintOpacity = Convert.ToSingle(TintOpacity);
33 | if (tintOpacity < 0f) tintOpacity = 0f;
34 | if (tintOpacity > 1f) tintOpacity = 1f;
35 | var arithmeticEffect = new ArithmeticCompositeEffect()
36 | {
37 | Name = "arithmetic",
38 | MultiplyAmount = 0,
39 | Source1Amount = 1f - tintOpacity,
40 | Source2Amount = tintOpacity,
41 | Source1 = new ArithmeticCompositeEffect()
42 | {
43 | MultiplyAmount = 0f,
44 | Source1Amount = 0.95f,
45 | Source2Amount = 0.05f,
46 | Source1 = new GaussianBlurEffect()
47 | {
48 | Name = "blur",
49 | BlurAmount = Convert.ToSingle(BlurAmount),
50 | BorderMode = EffectBorderMode.Hard,
51 | Optimization = EffectOptimization.Balanced,
52 | Source = new CompositionEffectSourceParameter("source"),
53 | },
54 | Source2 = new BorderEffect()
55 | {
56 | Source = new CompositionEffectSourceParameter("image"),
57 | ExtendX = CanvasEdgeBehavior.Wrap,
58 | ExtendY = CanvasEdgeBehavior.Wrap,
59 | }
60 | },
61 | Source2 = new ColorSourceEffect()
62 | {
63 | Name = "tintcolor",
64 | Color = TintColor
65 | }
66 | };
67 |
68 | Brush = compositor.CreateEffectFactory(arithmeticEffect, new[] { "arithmetic.Source1Amount", "arithmetic.Source2Amount", "tintcolor.Color" }).CreateBrush();
69 |
70 | var imagesurface = LoadedImageSurface.StartLoadFromUri(new Uri("ms-appx:///FluentDesignSystem/Sketch/SketchTexture.jpg"));
71 |
72 | var imagebrush = compositor.CreateSurfaceBrush(imagesurface);
73 | imagebrush.Stretch = CompositionStretch.None;
74 | Brush.SetSourceParameter("image", imagebrush);
75 |
76 | switch (BackgroundSource)
77 | {
78 | case AcrylicBackgroundSource.Backdrop:
79 | Brush.SetSourceParameter("source", compositor.CreateBackdropBrush());
80 | break;
81 | case AcrylicBackgroundSource.Hostbackdrop:
82 | Brush.SetSourceParameter("source", compositor.CreateHostBackdropBrush());
83 | break;
84 | }
85 |
86 | CompositionBrush = Brush;
87 |
88 | var line = compositor.CreateLinearEasingFunction();
89 |
90 | TintOpacityFillAnimation = compositor.CreateScalarKeyFrameAnimation();
91 | TintOpacityFillAnimation.InsertExpressionKeyFrame(0f, "TintOpacity", line);
92 | TintOpacityFillAnimation.InsertKeyFrame(1f, 1f, line);
93 | TintOpacityFillAnimation.Duration = TimeSpan.FromSeconds(0.1d);
94 | TintOpacityFillAnimation.Target = "arithmetic.Source2Amount";
95 |
96 | HostOpacityZeroAnimation = compositor.CreateScalarKeyFrameAnimation();
97 | HostOpacityZeroAnimation.InsertExpressionKeyFrame(0f, "1f - TintOpacity", line);
98 | HostOpacityZeroAnimation.InsertKeyFrame(1f, 0f, line);
99 | HostOpacityZeroAnimation.Duration = TimeSpan.FromSeconds(0.1d);
100 | HostOpacityZeroAnimation.Target = "arithmetic.Source1Amount";
101 |
102 | TintToFallBackAnimation = compositor.CreateColorKeyFrameAnimation();
103 | TintToFallBackAnimation.InsertKeyFrame(0f, TintColor, line);
104 | TintToFallBackAnimation.InsertKeyFrame(1f, FallbackColor, line);
105 | TintToFallBackAnimation.Duration = TimeSpan.FromSeconds(0.1d);
106 | TintToFallBackAnimation.Target = "tintcolor.Color";
107 |
108 | //Window.Current.Activated += Current_Activated;
109 | //Window.Current.VisibilityChanged += Current_VisibilityChanged;
110 | CoreWindow.GetForCurrentThread().Activated += AcrylicBrush_Activated;
111 | CoreWindow.GetForCurrentThread().VisibilityChanged += AcrylicBrush_VisibilityChanged;
112 | }
113 |
114 |
115 | protected override void OnDisconnected()
116 | {
117 | CoreWindow.GetForCurrentThread().Activated -= AcrylicBrush_Activated;
118 | CoreWindow.GetForCurrentThread().VisibilityChanged -= AcrylicBrush_VisibilityChanged;
119 | CompositionBrush.Dispose();
120 | CompositionBrush = null;
121 | }
122 |
123 | void SetCompositionFocus(bool IsGotFocus)
124 | {
125 | if (CompositionBrush == null) return;
126 | if (BackgroundSource == AcrylicBackgroundSource.Backdrop) return;
127 | var tintOpacity = Convert.ToSingle(TintOpacity);
128 | if (tintOpacity < 0f) tintOpacity = 0f;
129 | if (tintOpacity > 1f) tintOpacity = 1f;
130 | HostOpacityZeroAnimation.SetScalarParameter("TintOpacity", tintOpacity);
131 | TintOpacityFillAnimation.SetScalarParameter("TintOpacity", tintOpacity);
132 | if (IsGotFocus)
133 | {
134 | CompositionBrush = Brush;
135 | TintOpacityFillAnimation.Direction = AnimationDirection.Reverse;
136 | HostOpacityZeroAnimation.Direction = AnimationDirection.Reverse;
137 | TintToFallBackAnimation.Direction = AnimationDirection.Reverse;
138 | CompositionBrush.StartAnimation("arithmetic.Source2Amount", TintOpacityFillAnimation);
139 | CompositionBrush.StartAnimation("arithmetic.Source1Amount", HostOpacityZeroAnimation);
140 | CompositionBrush.StartAnimation("tintcolor.Color", TintToFallBackAnimation);
141 | }
142 | else if (CompositionBrush == Brush)
143 | {
144 | var scopedBatch = compositor.CreateScopedBatch(CompositionBatchTypes.Animation);
145 | TintOpacityFillAnimation.Direction = AnimationDirection.Normal;
146 | HostOpacityZeroAnimation.Direction = AnimationDirection.Normal;
147 | TintToFallBackAnimation.Direction = AnimationDirection.Normal;
148 | CompositionBrush.StartAnimation("arithmetic.Source2Amount", TintOpacityFillAnimation);
149 | CompositionBrush.StartAnimation("arithmetic.Source1Amount", HostOpacityZeroAnimation);
150 | CompositionBrush.StartAnimation("tintcolor.Color", TintToFallBackAnimation);
151 | scopedBatch.Completed += (s, a) => CompositionBrush = compositor.CreateColorBrush(FallbackColor);
152 | scopedBatch.End();
153 | }
154 | else CompositionBrush = compositor.CreateColorBrush(FallbackColor);
155 | }
156 |
157 | //private void Current_VisibilityChanged(object sender, VisibilityChangedEventArgs e)
158 | //{
159 | // if (BackgroundSource == AcrylicBackgroundSource.Hostbackdrop)
160 | // SetCompositionFocus(e.Visible);
161 | //}
162 |
163 | //private void Current_Activated(object sender, WindowActivatedEventArgs e)
164 | //{
165 | // if (BackgroundSource == AcrylicBackgroundSource.Hostbackdrop)
166 | // SetCompositionFocus(e.WindowActivationState != CoreWindowActivationState.Deactivated);
167 | //}
168 |
169 | private void AcrylicBrush_VisibilityChanged(CoreWindow sender, VisibilityChangedEventArgs args)
170 | {
171 | if (BackgroundSource == AcrylicBackgroundSource.Hostbackdrop)
172 | SetCompositionFocus(args.Visible);
173 | }
174 |
175 | private void AcrylicBrush_Activated(CoreWindow sender, WindowActivatedEventArgs args)
176 | {
177 | if (BackgroundSource == AcrylicBackgroundSource.Hostbackdrop)
178 | SetCompositionFocus(args.WindowActivationState != CoreWindowActivationState.Deactivated);
179 | }
180 |
181 | public AcrylicBackgroundSource BackgroundSource
182 | {
183 | get { return (AcrylicBackgroundSource)GetValue(BackgroundSourceProperty); }
184 | set { SetValue(BackgroundSourceProperty, value); }
185 | }
186 |
187 | public double BlurAmount
188 | {
189 | get { return (double)GetValue(BlurAmountProperty); }
190 | set { SetValue(BlurAmountProperty, value); }
191 | }
192 |
193 | public Color TintColor
194 | {
195 | get { return (Color)GetValue(TintColorProperty); }
196 | set { SetValue(TintColorProperty, value); }
197 | }
198 |
199 | public double TintOpacity
200 | {
201 | get { return (double)GetValue(TintOpacityProperty); }
202 | set { SetValue(TintOpacityProperty, value); }
203 | }
204 |
205 | public static readonly DependencyProperty BackgroundSourceProperty =
206 | DependencyProperty.Register("BackgroundSource", typeof(AcrylicBackgroundSource), typeof(AcrylicBrush), new PropertyMetadata(AcrylicBackgroundSource.Backdrop, OnBackgroundSourcePropertyChanged));
207 | public static readonly DependencyProperty BlurAmountProperty =
208 | DependencyProperty.Register("BlurAmount", typeof(double), typeof(AcrylicBrush), new PropertyMetadata(20d, OnBlurAmountPropertyChanged));
209 | public static readonly DependencyProperty TintColorProperty =
210 | DependencyProperty.Register("TintColor", typeof(Color), typeof(AcrylicBrush), new PropertyMetadata((Color)Application.Current.Resources["SystemChromeHighColor"], OnTintColorPropertyChanged));
211 | public static readonly DependencyProperty TintOpacityProperty =
212 | DependencyProperty.Register("TintOpacity", typeof(double), typeof(AcrylicBrush), new PropertyMetadata(0.7d, OnTintOpacityPropertyChanged));
213 |
214 | private static void OnBackgroundSourcePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
215 | {
216 | if (e.NewValue != e.OldValue)
217 | {
218 | if (e.NewValue != e.OldValue)
219 | {
220 | var sender = d as AcrylicBrush;
221 | if (DesignMode.DesignModeEnabled) return;
222 | else
223 | {
224 | if (sender.CompositionBrush == null) return;
225 | switch (e.NewValue)
226 | {
227 | case AcrylicBackgroundSource.Backdrop:
228 | (sender.CompositionBrush as CompositionEffectBrush).SetSourceParameter("source", sender.compositor.CreateBackdropBrush());
229 | break;
230 | case AcrylicBackgroundSource.Hostbackdrop:
231 | (sender.CompositionBrush as CompositionEffectBrush).SetSourceParameter("source", sender.compositor.CreateHostBackdropBrush());
232 | break;
233 | }
234 | }
235 | }
236 |
237 | }
238 | }
239 | private static void OnBlurAmountPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
240 | {
241 | if (e.NewValue != e.OldValue)
242 | {
243 | var sender = d as AcrylicBrush;
244 | if (DesignMode.DesignModeEnabled) return;
245 | else
246 | {
247 | if (sender.CompositionBrush == null) return;
248 | sender.CompositionBrush.Properties.InsertScalar("blur.BlurAmount", Convert.ToSingle(e.NewValue));
249 | }
250 | }
251 | }
252 | private static void OnTintColorPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
253 | {
254 | if (e.NewValue != e.OldValue)
255 | {
256 | var sender = d as AcrylicBrush;
257 | if (DesignMode.DesignModeEnabled) return;
258 | else
259 | {
260 | if (sender.CompositionBrush == null) return;
261 | sender.CompositionBrush.Properties.InsertColor("tintcolor.Color", (Color)e.NewValue);
262 | }
263 | }
264 | }
265 | private static void OnTintOpacityPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
266 | {
267 | if (e.NewValue != e.OldValue)
268 | {
269 | var sender = d as AcrylicBrush;
270 | if (DesignMode.DesignModeEnabled) return;
271 | else
272 | {
273 | if (sender.CompositionBrush == null) return;
274 | var tintOpacity = Convert.ToSingle(e.NewValue);
275 | if (tintOpacity < 0f) tintOpacity = 0f;
276 | if (tintOpacity > 1f) tintOpacity = 1f;
277 | sender.CompositionBrush.Properties.InsertScalar("arithmetic.Source1Amount", 1f - tintOpacity);
278 | sender.CompositionBrush.Properties.InsertScalar("arithmetic.Source2Amount", tintOpacity);
279 | }
280 | }
281 | }
282 | }
283 | }
284 |
--------------------------------------------------------------------------------
/FluentDesignSystem/Brushes/RevealBackgroundBrush.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Graphics.Canvas;
2 | using Microsoft.Graphics.Canvas.Effects;
3 | using Microsoft.Graphics.Canvas.UI.Composition;
4 | using System;
5 | using System.Collections.Generic;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using Windows.ApplicationModel;
10 | using Windows.Foundation;
11 | using Windows.Graphics.DirectX;
12 | using Windows.UI;
13 | using Windows.UI.Composition;
14 | using Windows.UI.Xaml;
15 | using Windows.UI.Xaml.Hosting;
16 | using Windows.UI.Xaml.Media;
17 |
18 | namespace FluentDesignSystem.Brushes
19 | {
20 | public class RevealBackgroundBrush : RevealBrush
21 | {
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/FluentDesignSystem/Brushes/RevealBorderBrush.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Graphics.Canvas;
2 | using Microsoft.Graphics.Canvas.Effects;
3 | using Microsoft.Graphics.Canvas.UI.Composition;
4 | using System;
5 | using System.Collections.Generic;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using Windows.ApplicationModel;
10 | using Windows.Foundation;
11 | using Windows.Graphics.DirectX;
12 | using Windows.UI;
13 | using Windows.UI.Composition;
14 | using Windows.UI.Xaml;
15 | using Windows.UI.Xaml.Hosting;
16 | using Windows.UI.Xaml.Media;
17 |
18 | namespace FluentDesignSystem.Brushes
19 | {
20 | public class RevealBorderBrush : RevealBrush
21 | {
22 | Compositor compositor;
23 |
24 | protected override void OnConnected()
25 | {
26 | if (DesignMode.DesignModeEnabled) return;
27 | compositor = ElementCompositionPreview.GetElementVisual(Window.Current.Content as UIElement).Compositor;
28 | var compositeEffect = new CompositeEffect() { Mode = CanvasComposite.Add };
29 | compositeEffect.Sources.Add(new BorderEffect()
30 | {
31 | Source = new CompositionEffectSourceParameter("backdrop"),
32 | ExtendX = CanvasEdgeBehavior.Clamp,
33 | ExtendY = CanvasEdgeBehavior.Clamp
34 | });
35 | compositeEffect.Sources.Add(new BorderEffect()
36 | {
37 | Source = new CompositionEffectSourceParameter("color"),
38 | ExtendX = CanvasEdgeBehavior.Clamp,
39 | ExtendY = CanvasEdgeBehavior.Clamp
40 | });
41 |
42 | var Brush = compositor.CreateEffectFactory(compositeEffect).CreateBrush();
43 | Brush.SetSourceParameter("backdrop", compositor.CreateBackdropBrush());
44 | Brush.SetSourceParameter("color", compositor.CreateColorBrush(Color));
45 | CompositionBrush = Brush;
46 |
47 | XamlLight.AddTargetBrush(Lights.RevealAmbientLight.GetIdStatic(), this);
48 | XamlLight.AddTargetBrush(Lights.RevealBorderSpotLight.GetIdStatic(), this);
49 | }
50 | protected override void OnDisconnected()
51 | {
52 | base.OnDisconnected();
53 | XamlLight.RemoveTargetBrush(Lights.RevealAmbientLight.GetIdStatic(), this);
54 | XamlLight.RemoveTargetBrush(Lights.RevealBorderSpotLight.GetIdStatic(), this);
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/FluentDesignSystem/Brushes/RevealBrush.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Graphics.Canvas;
2 | using Microsoft.Graphics.Canvas.Effects;
3 | using Microsoft.Graphics.Canvas.UI.Composition;
4 | using System;
5 | using System.Collections.Generic;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using Windows.ApplicationModel;
10 | using Windows.Foundation;
11 | using Windows.Graphics.DirectX;
12 | using Windows.UI;
13 | using Windows.UI.Composition;
14 | using Windows.UI.Xaml;
15 | using Windows.UI.Xaml.Controls;
16 | using Windows.UI.Xaml.Hosting;
17 | using Windows.UI.Xaml.Media;
18 |
19 | namespace FluentDesignSystem.Brushes
20 | {
21 | public class RevealBrush : XamlCompositionBrushBase
22 | {
23 | Compositor compositor;
24 |
25 | protected override void OnConnected()
26 | {
27 | if (DesignMode.DesignModeEnabled) return;
28 | compositor = ElementCompositionPreview.GetElementVisual(Window.Current.Content as UIElement).Compositor;
29 | var borderEffect = new BorderEffect()
30 | {
31 | Source = new CompositionEffectSourceParameter("color"),
32 | ExtendX = CanvasEdgeBehavior.Clamp,
33 | ExtendY = CanvasEdgeBehavior.Clamp
34 | };
35 |
36 | var Brush = compositor.CreateEffectFactory(borderEffect).CreateBrush();
37 | Brush.SetSourceParameter("color", compositor.CreateColorBrush(Color));
38 | CompositionBrush = Brush;
39 | }
40 |
41 | protected override void OnDisconnected()
42 | {
43 | CompositionBrush.Dispose();
44 | CompositionBrush = null;
45 | }
46 |
47 | public Color Color
48 | {
49 | get { return (Color)GetValue(ColorProperty); }
50 | set { SetValue(ColorProperty, value); }
51 | }
52 |
53 | public ApplicationTheme TargetTheme
54 | {
55 | get { return (ApplicationTheme)GetValue(TargetThemeProperty); }
56 | set { SetValue(TargetThemeProperty, value); }
57 | }
58 |
59 | public static readonly DependencyProperty ColorProperty =
60 | DependencyProperty.Register("Color", typeof(Color), typeof(RevealBrush), new PropertyMetadata(Colors.Transparent, OnColorPropertyChanged));
61 | public static readonly DependencyProperty TargetThemeProperty =
62 | DependencyProperty.Register("TargetTheme", typeof(ApplicationTheme), typeof(RevealBrush), new PropertyMetadata(Application.Current.RequestedTheme, OnTargetThemePropertyChanged));
63 |
64 | private static void OnColorPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
65 | {
66 | //if (DesignMode.DesignModeEnabled) return;
67 | //if (e.NewValue != e.OldValue)
68 | //{
69 | // var sender = d as RevealBrush;
70 | // if (sender.CompositionBrush == null) return;
71 | // sender.CompositionBrush.Properties.InsertColor("color.Color", (Color)e.NewValue);
72 | //}
73 |
74 | if (DesignMode.DesignModeEnabled) return;
75 | if (e.NewValue != e.OldValue)
76 | {
77 | var sender = d as RevealBrush;
78 | if (sender.CompositionBrush == null) return;
79 | (sender.CompositionBrush as CompositionEffectBrush).SetSourceParameter("color", sender.compositor.CreateColorBrush(sender.Color));
80 | }
81 | }
82 |
83 | private static void OnTargetThemePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
84 | {
85 | if (DesignMode.DesignModeEnabled) return;
86 | if (e.NewValue != e.OldValue)
87 | {
88 | var sender = d as RevealBrush;
89 | if (sender.CompositionBrush == null) return;
90 | }
91 | }
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/FluentDesignSystem/Brushes/RevealBrushState.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace FluentDesignSystem.Brushes
8 | {
9 | public enum RevealBrushState
10 | {
11 | Normal, PointerOver, Pressed
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/FluentDesignSystem/FluentDesignSystem.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {47E75263-FFE8-4C6C-99CF-D847C330076E}
8 | Library
9 | Properties
10 | FluentDesignSystem
11 | FluentDesignSystem
12 | zh-CN
13 | UAP
14 | 10.0.15063.0
15 | 10.0.15063.0
16 | 14
17 | 512
18 | {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
19 |
20 |
21 | AnyCPU
22 | true
23 | full
24 | false
25 | bin\Debug\
26 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
27 | prompt
28 | 4
29 |
30 |
31 | AnyCPU
32 | pdbonly
33 | true
34 | bin\Release\
35 | TRACE;NETFX_CORE;WINDOWS_UWP
36 | prompt
37 | 4
38 |
39 |
40 | x86
41 | true
42 | bin\x86\Debug\
43 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
44 | ;2008
45 | full
46 | x86
47 | false
48 | prompt
49 |
50 |
51 | x86
52 | bin\x86\Release\
53 | TRACE;NETFX_CORE;WINDOWS_UWP
54 | true
55 | ;2008
56 | pdbonly
57 | x86
58 | false
59 | prompt
60 |
61 |
62 | ARM
63 | true
64 | bin\ARM\Debug\
65 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
66 | ;2008
67 | full
68 | ARM
69 | false
70 | prompt
71 |
72 |
73 | ARM
74 | bin\ARM\Release\
75 | TRACE;NETFX_CORE;WINDOWS_UWP
76 | true
77 | ;2008
78 | pdbonly
79 | ARM
80 | false
81 | prompt
82 |
83 |
84 | x64
85 | true
86 | bin\x64\Debug\
87 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
88 | ;2008
89 | full
90 | x64
91 | false
92 | prompt
93 |
94 |
95 | x64
96 | bin\x64\Release\
97 | TRACE;NETFX_CORE;WINDOWS_UWP
98 | true
99 | ;2008
100 | pdbonly
101 | x64
102 | false
103 | prompt
104 |
105 |
106 | PackageReference
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 | 5.4.0
127 |
128 |
129 | 1.21.0
130 |
131 |
132 |
133 |
134 | PreserveNewest
135 |
136 |
137 |
138 |
139 | Designer
140 | MSBuild:Compile
141 | PreserveNewest
142 |
143 |
144 | Designer
145 | MSBuild:Compile
146 | PreserveNewest
147 |
148 |
149 |
150 | 14.0
151 |
152 |
153 |
160 |
--------------------------------------------------------------------------------
/FluentDesignSystem/Helper/RevealBrushHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Numerics;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using Windows.ApplicationModel;
8 | using Windows.UI;
9 | using Windows.UI.Core;
10 | using Windows.UI.Xaml;
11 | using Windows.UI.Xaml.Controls;
12 | using Windows.UI.Xaml.Controls.Primitives;
13 | using Windows.UI.Xaml.Input;
14 | using Windows.UI.Xaml.Media;
15 | using static FluentDesignSystem.StaticValue;
16 |
17 | namespace FluentDesignSystem.Helper
18 | {
19 | public static class RevealBrushHelper
20 | {
21 | public static RevealBrushHelperState GetState(UIElement element)
22 | {
23 | return (RevealBrushHelperState)element.GetValue(StateProperty);
24 | }
25 |
26 | public static void SetState(UIElement element, RevealBrushHelperState value)
27 | {
28 | element.SetValue(StateProperty, value);
29 | }
30 |
31 | public static readonly DependencyProperty StateProperty =
32 | DependencyProperty.RegisterAttached("State", typeof(RevealBrushHelperState), typeof(RevealBrushHelper), new PropertyMetadata(RevealBrushHelperState.Normal, OnStatePropertyChanged));
33 |
34 | private static void OnStatePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
35 | {
36 | if (DesignMode.DesignModeEnabled) return;
37 | if (e.NewValue != null && e.NewValue != e.OldValue)
38 | {
39 | var element = (d as UIElement);
40 | if (element == null) return;
41 | InitLights();
42 | switch ((RevealBrushHelperState)e.NewValue)
43 | {
44 | case RevealBrushHelperState.Normal:
45 | {
46 | if (element is Grid grid && InPopupGridNameList.Contains(grid.Name))
47 | {
48 | element.AddHandler(UIElement.PointerExitedEvent, new PointerEventHandler(element_PointerExited), true);
49 | element.AddHandler(UIElement.PointerMovedEvent, new PointerEventHandler(element_PointerMoved), true);
50 | SetPopupLight();
51 | }
52 | else
53 | {
54 | RevealBrushHelper.SetTargetLight(element, SetLightMode.Border);
55 | }
56 | SetElementContentLightPressed(element, false);
57 | }
58 | return;
59 | case RevealBrushHelperState.PointerOver:
60 | {
61 | if (element is Grid grid && InPopupGridNameList.Contains(grid.Name))
62 | {
63 | SetPopupLight();
64 | }
65 | RevealBrushHelper.SetTargetLight(element, SetLightMode.All);
66 | SetElementContentLightPressed(element, false);
67 | }
68 | break;
69 | case RevealBrushHelperState.Pressed:
70 | {
71 | if (element is Grid grid && InPopupGridNameList.Contains(grid.Name))
72 | {
73 | SetPopupLight();
74 | }
75 | RevealBrushHelper.SetTargetLight(element, SetLightMode.All);
76 | SetElementContentLightPressed(element, true);
77 | }
78 | break;
79 | }
80 | }
81 | }
82 |
83 | private static void PointerExited(CoreWindow sender, PointerEventArgs e)
84 | {
85 | RemoveLights();
86 | }
87 |
88 | private static void PointerEntered(CoreWindow sender, PointerEventArgs e)
89 | {
90 | InitLights();
91 | }
92 |
93 | private static void PointerMoved(CoreWindow sender, PointerEventArgs args)
94 | {
95 | var position = args.CurrentPoint.Position.ToVector2();
96 | if (BorderLight != null)
97 | BorderLight.SetPosition(position);
98 | if (ContentLight != null)
99 | ContentLight.SetPosition(position);
100 | }
101 |
102 | private static void InitLights()
103 | {
104 | if (AmbientLight == null) AmbientLight = new Lights.RevealAmbientLight();
105 | if (BorderLight == null) BorderLight = new Lights.RevealBorderSpotLight();
106 | if (ContentLight == null) ContentLight = new Lights.RevealContentSpotLight();
107 |
108 | if (Window.Current.Content.Lights.Count == 0)
109 | {
110 | Window.Current.Content.Lights.Add(AmbientLight);
111 | Window.Current.Content.Lights.Add(BorderLight);
112 | Window.Current.Content.Lights.Add(ContentLight);
113 | }
114 |
115 | if (!IsWindowPointerEnteredHandled)
116 | {
117 | CoreWindow.GetForCurrentThread().PointerEntered += PointerEntered;
118 | IsWindowPointerEnteredHandled = true;
119 | }
120 | if (!IsWindowPointerExitedHandled)
121 | {
122 | CoreWindow.GetForCurrentThread().PointerExited += PointerExited;
123 | IsWindowPointerExitedHandled = true;
124 |
125 | }
126 | if (!IsWindowPointerMovedHandled)
127 | {
128 | CoreWindow.GetForCurrentThread().PointerMoved += PointerMoved;
129 | IsWindowPointerMovedHandled = true;
130 | }
131 | }
132 |
133 | private static void RemoveLights()
134 | {
135 | Window.Current.Content.Lights.Clear();
136 | }
137 |
138 | private static void SetElementContentLightPressed(UIElement element, bool IsPressed)
139 | {
140 | ContentLight.IsPressedEnable = IsPressed;
141 | foreach (var popup in VisualTreeHelper.GetOpenPopups(Window.Current))
142 | {
143 | var contentLight = GetContentLight(popup);
144 | if (contentLight != null) contentLight.IsPressedEnable = IsPressed;
145 | }
146 | }
147 |
148 | private static void SetPopupLight()
149 | {
150 | foreach (var popup in VisualTreeHelper.GetOpenPopups(Window.Current))
151 | {
152 | if (popup.Lights.Count == 0)
153 | {
154 | popup.Lights.Add(ChildAmbientLight);
155 | popup.Lights.Add(ChildContentLight);
156 | }
157 | }
158 | }
159 |
160 | private static void RemovePopupLight()
161 | {
162 | foreach (var popup in VisualTreeHelper.GetOpenPopups(Window.Current))
163 | {
164 | popup.Lights.Clear();
165 | }
166 | }
167 |
168 | private static Lights.RevealContentSpotLight GetContentLight(UIElement element)
169 | {
170 | foreach (var light in element.Lights)
171 | {
172 | if (light is Lights.RevealContentSpotLight ContentLight && ContentLight.IsConnected)
173 | return ContentLight;
174 | }
175 | return null;
176 | }
177 |
178 | public static void SetTargetLight(UIElement Target, SetLightMode Mode)
179 | {
180 | switch (Target)
181 | {
182 | case Grid element:
183 | switch (Mode)
184 | {
185 | case SetLightMode.None:
186 | XamlLight.RemoveTargetElement(Lights.RevealAmbientLight.GetIdStatic(), element);
187 | XamlLight.RemoveTargetElement(Lights.RevealContentSpotLight.GetIdStatic(), element);
188 | break;
189 | case SetLightMode.Border:
190 | XamlLight.AddTargetElement(Lights.RevealAmbientLight.GetIdStatic(), element);
191 | XamlLight.RemoveTargetElement(Lights.RevealContentSpotLight.GetIdStatic(), element);
192 | break;
193 | case SetLightMode.All:
194 | XamlLight.AddTargetElement(Lights.RevealAmbientLight.GetIdStatic(), element);
195 | XamlLight.AddTargetElement(Lights.RevealContentSpotLight.GetIdStatic(), element);
196 | break;
197 | }
198 | break;
199 | }
200 |
201 | }
202 |
203 | private static void element_PointerExited(object sender, PointerRoutedEventArgs e)
204 | {
205 | var element = sender as UIElement;
206 | RevealBrushHelper.SetTargetLight(element, SetLightMode.Border);
207 | RemovePopupLight();
208 | element.RemoveHandler(UIElement.PointerMovedEvent, new PointerEventHandler(element_PointerMoved));
209 | element.RemoveHandler(UIElement.PointerExitedEvent, new PointerEventHandler(element_PointerExited));
210 | }
211 |
212 | private static void element_PointerMoved(object sender, PointerRoutedEventArgs e)
213 | {
214 | foreach (var popup in VisualTreeHelper.GetOpenPopups(Window.Current))
215 | {
216 | var position = (sender as UIElement).TransformToVisual(popup).TransformPoint(e.GetCurrentPoint(sender as UIElement).Position).ToVector2();
217 | var contentLight = GetContentLight(popup);
218 | if (contentLight != null) contentLight.SetPosition(position);
219 | }
220 | }
221 |
222 | public enum SetLightMode
223 | {
224 | None = -1,
225 | Border = 0,
226 | All = 1
227 | }
228 | }
229 | }
230 |
--------------------------------------------------------------------------------
/FluentDesignSystem/Helper/RevealBrushHelperState.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace FluentDesignSystem.Helper
8 | {
9 | public enum RevealBrushHelperState
10 | {
11 | Normal, PointerOver, Pressed
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/FluentDesignSystem/Lights/RevealAmbientLight.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using Windows.UI;
7 | using Windows.UI.Composition;
8 | using Windows.UI.Xaml;
9 | using Windows.UI.Xaml.Hosting;
10 | using Windows.UI.Xaml.Media;
11 |
12 | namespace FluentDesignSystem.Lights
13 | {
14 | public class RevealAmbientLight : XamlLight
15 | {
16 | Compositor compositor;
17 |
18 | protected override void OnConnected(UIElement newElement)
19 | {
20 | compositor = ElementCompositionPreview.GetElementVisual(Window.Current.Content).Compositor;
21 | var ambientlight = compositor.CreateAmbientLight();
22 | ambientlight.Color = Colors.White;
23 | CompositionLight = ambientlight;
24 | }
25 |
26 | protected override void OnDisconnected(UIElement oldElement)
27 | {
28 | base.OnDisconnected(oldElement);
29 | }
30 |
31 | protected override string GetId()
32 | {
33 | return GetIdStatic();
34 | }
35 |
36 | public static string GetIdStatic()
37 | {
38 | return typeof(RevealAmbientLight).FullName;
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/FluentDesignSystem/Lights/RevealBorderSpotLight.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Numerics;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using Windows.Foundation;
8 | using Windows.UI;
9 | using Windows.UI.Composition;
10 | using Windows.UI.Core;
11 | using Windows.UI.Xaml;
12 | using Windows.UI.Xaml.Controls;
13 | using Windows.UI.Xaml.Hosting;
14 | using Windows.UI.Xaml.Input;
15 | using Windows.UI.Xaml.Media;
16 |
17 | namespace FluentDesignSystem.Lights
18 | {
19 | public class RevealBorderSpotLight : XamlLight
20 | {
21 | UIElement element;
22 | Compositor compositor;
23 | CubicBezierEasingFunction cbEasing;
24 | LinearEasingFunction line;
25 | CompositionPropertySet PropSet;
26 | ExpressionAnimation SpotLightOffsetAnimation;
27 |
28 |
29 | protected override void OnConnected(UIElement newElement)
30 | {
31 | element = newElement;
32 |
33 | compositor = ElementCompositionPreview.GetElementVisual(Window.Current.Content).Compositor;
34 | var spotlight = compositor.CreateSpotLight();
35 | spotlight.InnerConeAngleInDegrees = 10f;
36 | spotlight.OuterConeAngleInDegrees = 20f;
37 | spotlight.InnerConeColor = Colors.FloralWhite;
38 | spotlight.OuterConeColor = Colors.FloralWhite;
39 | spotlight.ConstantAttenuation = 0f;
40 | spotlight.LinearAttenuation = 0f;
41 | spotlight.QuadraticAttenuation = 0f;
42 | CompositionLight = spotlight;
43 |
44 | PropSet = compositor.CreatePropertySet();
45 | PropSet.InsertScalar("OffsetX", 0f);
46 | PropSet.InsertScalar("OffsetY", 0f);
47 | PropSet.InsertScalar("OffsetZ", 300f);
48 |
49 | SpotLightOffsetAnimation = compositor.CreateExpressionAnimation("Vector3(PropSet.OffsetX ,PropSet.OffsetY ,PropSet.OffsetZ)");
50 | SpotLightOffsetAnimation.SetReferenceParameter("PropSet", PropSet);
51 | CompositionLight.StartAnimation("Offset", SpotLightOffsetAnimation);
52 | cbEasing = compositor.CreateCubicBezierEasingFunction(new Vector2(0.42f, 0f), new Vector2(1f, 1f));
53 | line = compositor.CreateLinearEasingFunction();
54 | var an = compositor.CreateScalarKeyFrameAnimation();
55 | an.InsertKeyFrame(0f, 0f, cbEasing);
56 | an.InsertKeyFrame(1f, 60f, cbEasing);
57 | an.Duration = TimeSpan.FromSeconds(10);
58 | an.IterationBehavior = AnimationIterationBehavior.Forever;
59 | }
60 |
61 | protected override void OnDisconnected(UIElement oldElement)
62 | {
63 | element = null;
64 | }
65 |
66 | protected override string GetId()
67 | {
68 | return GetIdStatic();
69 | }
70 |
71 | public static string GetIdStatic()
72 | {
73 | return typeof(RevealBorderSpotLight).FullName;
74 | }
75 |
76 | public void SetPosition(Vector2 position)
77 | {
78 | PropSet.InsertScalar("OffsetX", position.X);
79 | PropSet.InsertScalar("OffsetY", position.Y);
80 | }
81 |
82 |
83 | //private void Border_PointerMoved(object sender, PointerRoutedEventArgs e)
84 | //{
85 | // var windowposition = e.GetCurrentPoint(sender as UIElement).Position;
86 | // var position = (sender as UIElement).TransformToVisual(element).TransformPoint(windowposition).ToVector2();
87 | // PropSet.InsertScalar("OffsetX", position.X);
88 | // PropSet.InsertScalar("OffsetY", position.Y);
89 | //}
90 |
91 | //private void Border_PointerExited(object sender, PointerRoutedEventArgs e)
92 | //{
93 | // //if (element is Panel)
94 | // //{
95 | // // if ((element as Grid).BorderBrush == null) return;
96 | // // RemoveTargetBrush(GetId(), (element as Grid).BorderBrush);
97 | // //}
98 | // //if (element is Border)
99 | // //{
100 | // // if ((element as Border).BorderBrush == null) return;
101 | // // RemoveTargetBrush(GetId(), (element as Border).BorderBrush);
102 | // //}
103 | // //if (element is Button)
104 | // //{
105 | // // if ((element as Button).BorderBrush == null) return;
106 | // // RemoveTargetBrush(GetId(), (element as Button).BorderBrush);
107 | // //}
108 | //}
109 |
110 | //private void Border_PointerMoved(CoreWindow sender, PointerEventArgs e)
111 | //{
112 | // var position = e.CurrentPoint.Position.ToVector2();
113 | // //var position = Window.Current.Content.TransformToVisual(element).TransformPoint(windowposition).ToVector2();
114 | // PropSet.InsertScalar("OffsetX", position.X);
115 | // PropSet.InsertScalar("OffsetY", position.Y);
116 | //}
117 |
118 | //private void Border_PointerExited(CoreWindow sender, PointerEventArgs e)
119 | //{
120 |
121 | //}
122 | }
123 |
124 | }
125 |
--------------------------------------------------------------------------------
/FluentDesignSystem/Lights/RevealContentSpotLight.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Numerics;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using Windows.Foundation;
8 | using Windows.UI;
9 | using Windows.UI.Composition;
10 | using Windows.UI.Xaml;
11 | using Windows.UI.Xaml.Controls;
12 | using Windows.UI.Xaml.Controls.Primitives;
13 | using Windows.UI.Xaml.Hosting;
14 | using Windows.UI.Xaml.Input;
15 | using Windows.UI.Xaml.Media;
16 |
17 | namespace FluentDesignSystem.Lights
18 | {
19 | public class RevealContentSpotLight : XamlLight
20 | {
21 | public bool IsConnected
22 | {
23 | get => compositor != null;
24 | }
25 |
26 | UIElement element;
27 | Compositor compositor;
28 | CubicBezierEasingFunction cbEasing;
29 | LinearEasingFunction line;
30 | public CompositionPropertySet PropSet;
31 | ExpressionAnimation SpotLightOffsetAnimation;
32 | ExpressionAnimation LinearAttenuationAnimation;
33 | ColorKeyFrameAnimation ReleasedInnerConeColorAnimation;
34 | ScalarKeyFrameAnimation PressedPropSetOffsetZAnimation;
35 | ScalarKeyFrameAnimation ReleasedPropSetOffsetZAnimation;
36 |
37 | protected override void OnConnected(UIElement newElement)
38 | {
39 | element = newElement;
40 |
41 | compositor = ElementCompositionPreview.GetElementVisual(Window.Current.Content).Compositor;
42 | var spotlight = compositor.CreateSpotLight();
43 | spotlight.InnerConeAngleInDegrees = 10f;
44 | spotlight.OuterConeAngleInDegrees = 35f;
45 | spotlight.InnerConeColor = Colors.FloralWhite;
46 | spotlight.OuterConeColor = Colors.FloralWhite;
47 | spotlight.ConstantAttenuation = 2f;
48 | spotlight.LinearAttenuation = 0f;
49 | spotlight.QuadraticAttenuation = 0f;
50 | CompositionLight = spotlight;
51 |
52 | PropSet = compositor.CreatePropertySet();
53 | PropSet.InsertScalar("OffsetX", 0f);
54 | PropSet.InsertScalar("OffsetY", 0f);
55 | PropSet.InsertScalar("OffsetZ", 500f);
56 |
57 | SpotLightOffsetAnimation = compositor.CreateExpressionAnimation("Vector3(PropSet.OffsetX ,PropSet.OffsetY ,PropSet.OffsetZ)");
58 | SpotLightOffsetAnimation.SetReferenceParameter("PropSet", PropSet);
59 | CompositionLight.StartAnimation("Offset", SpotLightOffsetAnimation);
60 |
61 | //newElement.AddHandler(UIElement.PointerMovedEvent, new PointerEventHandler(Content_PointerMoved), true);
62 | //newElement.AddHandler(UIElement.PointerExitedEvent, new PointerEventHandler(Content_PointerExited), true);
63 | //newElement.AddHandler(UIElement.PointerPressedEvent, new PointerEventHandler(Content_PointerPressed), true);
64 | //newElement.AddHandler(UIElement.PointerReleasedEvent, new PointerEventHandler(Content_PointerReleased), true);
65 |
66 | cbEasing = compositor.CreateCubicBezierEasingFunction(new Vector2(0.42f, 0f), new Vector2(1f, 1f));
67 | line = compositor.CreateLinearEasingFunction();
68 | var an = compositor.CreateScalarKeyFrameAnimation();
69 | an.InsertKeyFrame(0f, 0f, cbEasing);
70 | an.InsertKeyFrame(1f, 60f, cbEasing);
71 | an.Duration = TimeSpan.FromSeconds(10);
72 | an.IterationBehavior = AnimationIterationBehavior.Forever;
73 |
74 | LinearAttenuationAnimation = compositor.CreateExpressionAnimation("PropSet.OffsetZ / 1600");
75 | LinearAttenuationAnimation.SetReferenceParameter("PropSet", PropSet);
76 | CompositionLight.StartAnimation("LinearAttenuation", LinearAttenuationAnimation);
77 |
78 | PressedPropSetOffsetZAnimation = compositor.CreateScalarKeyFrameAnimation();
79 | PressedPropSetOffsetZAnimation.InsertKeyFrame(0f, 200f, line);
80 | PressedPropSetOffsetZAnimation.InsertKeyFrame(0.005f, 45f, cbEasing);
81 | PressedPropSetOffsetZAnimation.InsertKeyFrame(1f, 800f, cbEasing);
82 | PressedPropSetOffsetZAnimation.Duration = TimeSpan.FromSeconds(10);
83 | PressedPropSetOffsetZAnimation.Target = "OffsetZ";
84 |
85 | ReleasedInnerConeColorAnimation = compositor.CreateColorKeyFrameAnimation();
86 | ReleasedInnerConeColorAnimation.InsertExpressionKeyFrame(0.9f, "this.StartingValue", line);
87 | ReleasedInnerConeColorAnimation.InsertKeyFrame(1f, Colors.FloralWhite, line);
88 | ReleasedInnerConeColorAnimation.Duration = TimeSpan.FromSeconds(1.5d);
89 | ReleasedInnerConeColorAnimation.Target = "InnerConeColor";
90 |
91 | ReleasedPropSetOffsetZAnimation = compositor.CreateScalarKeyFrameAnimation();
92 | ReleasedPropSetOffsetZAnimation.InsertExpressionKeyFrame(0f, "this.StartingValue", cbEasing);
93 | ReleasedPropSetOffsetZAnimation.InsertKeyFrame(1f, 500f, cbEasing);
94 | ReleasedPropSetOffsetZAnimation.Duration = TimeSpan.FromSeconds(0.15);
95 | ReleasedPropSetOffsetZAnimation.Target = "OffsetZ";
96 | }
97 |
98 | protected override void OnDisconnected(UIElement oldElement)
99 | {
100 | //oldElement.RemoveHandler(UIElement.PointerMovedEvent, new PointerEventHandler(Content_PointerMoved));
101 | //oldElement.RemoveHandler(UIElement.PointerExitedEvent, new PointerEventHandler(Content_PointerExited));
102 | //oldElement.RemoveHandler(UIElement.PointerPressedEvent, new PointerEventHandler(Content_PointerPressed));
103 | //oldElement.RemoveHandler(UIElement.PointerReleasedEvent, new PointerEventHandler(Content_PointerReleased));
104 | }
105 |
106 | protected override string GetId()
107 | {
108 | return GetIdStatic();
109 | }
110 |
111 | public static string GetIdStatic()
112 | {
113 | return typeof(RevealContentSpotLight).FullName;
114 | }
115 |
116 | public void SetPosition(Vector2 position)
117 | {
118 | PropSet.InsertScalar("OffsetX", position.X);
119 | PropSet.InsertScalar("OffsetY", position.Y);
120 | }
121 |
122 | void ContentPressed()
123 | {
124 | (CompositionLight as SpotLight).StopAnimation("InnerConeColor");
125 | PropSet.StopAnimation("OffsetZ");
126 | (CompositionLight as SpotLight).InnerConeColor = Colors.Black;
127 | PropSet.StartAnimation("OffsetZ", PressedPropSetOffsetZAnimation);
128 | }
129 |
130 | void ContentReleased()
131 | {
132 | (CompositionLight as SpotLight).StopAnimation("InnerConeColor");
133 | PropSet.StopAnimation("OffsetZ");
134 | (CompositionLight as SpotLight).StartAnimation("InnerConeColor", ReleasedInnerConeColorAnimation);
135 | PropSet.StartAnimation("OffsetZ", ReleasedPropSetOffsetZAnimation);
136 | }
137 |
138 |
139 |
140 | public bool IsPressedEnable
141 | {
142 | get { return (bool)GetValue(IsPressedEnableProperty); }
143 | set { SetValue(IsPressedEnableProperty, value); }
144 | }
145 |
146 | // Using a DependencyProperty as the backing store for IsPressed. This enables animation, styling, binding, etc...
147 | public static readonly DependencyProperty IsPressedEnableProperty =
148 | DependencyProperty.Register("IsPressedEnable", typeof(bool), typeof(RevealContentSpotLight), new PropertyMetadata(false, (s, a) =>
149 | {
150 | if (a.NewValue != a.OldValue)
151 | {
152 | var isPressEnable = (bool)a.NewValue;
153 | var sender = s as RevealContentSpotLight;
154 | if (isPressEnable) sender.ContentPressed();
155 | else sender.ContentReleased();
156 | }
157 | }));
158 |
159 |
160 |
161 |
162 | //private void Content_PointerMoved(object sender, PointerRoutedEventArgs e)
163 | //{
164 | // var position = e.GetCurrentPoint(sender as UIElement).Position.ToVector2();
165 | // PropSet.InsertScalar("OffsetX", position.X);
166 | // PropSet.InsertScalar("OffsetY", position.Y);
167 | //}
168 |
169 | //private void Content_PointerExited(object sender, PointerRoutedEventArgs e)
170 | //{
171 | // if (Window.Current.Content.Lights.Count != 0)
172 | // {
173 | // Window.Current.Content.Lights.Clear();
174 | // }
175 | //}
176 |
177 |
178 | //private void Content_PointerReleased(object sender, PointerRoutedEventArgs e)
179 | //{
180 | // ContentReleased();
181 | //}
182 |
183 | //private void Content_PointerPressed(object sender, PointerRoutedEventArgs e)
184 | //{
185 | // ContentPressed();
186 | //}
187 | }
188 | }
189 |
--------------------------------------------------------------------------------
/FluentDesignSystem/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("FluentDesignSystem")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("FluentDesignSystem")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Version information for an assembly consists of the following four values:
18 | //
19 | // Major Version
20 | // Minor Version
21 | // Build Number
22 | // Revision
23 | //
24 | // You can specify all the values or you can default the Build and Revision Numbers
25 | // by using the '*' as shown below:
26 | // [assembly: AssemblyVersion("1.0.*")]
27 | [assembly: AssemblyVersion("1.0.0.0")]
28 | [assembly: AssemblyFileVersion("1.0.0.0")]
29 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/FluentDesignSystem/Properties/FluentDesignSystem.rd.xml:
--------------------------------------------------------------------------------
1 |
2 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/FluentDesignSystem/ResourceDictionarys/ThemeResources.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 | #CC1F1F1F
9 | #FF1F1F1F
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 | #F2000000
47 | #30000000
48 | #91000000
49 | #C2000000
50 | #61000000
51 | #F2FFFFFF
52 | #30FFFFFF
53 | #91FFFFFF
54 | #C2FFFFFF
55 | #61FFFFFF
56 | #F2F9F9F9
57 | #F2000000
58 | #30000000
59 | #61000000
60 | #C2000000
61 | #F2767676
62 | #F21F1F1F
63 | #F2393939
64 | #F22B2B2B
65 | #F2FFFFFF
66 | #F2767676
67 | #18FFFFFF
68 | #30FFFFFF
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 | 2
91 | 2
92 | 2
93 | 1
94 | 1
95 | 1
96 | 1
97 | 1
98 | 1
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 | #CCFFFFFF
222 | #FFFFFFFF
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 | #E6FFFFFF
260 | #2EFFFFFF
261 | #8AFFFFFF
262 | #B8FFFFFF
263 | #61FFFFFF
264 | #E6000000
265 | #2E000000
266 | #8A000000
267 | #B8000000
268 | #61000000
269 | #E6171717
270 | #E6000000
271 | #2E000000
272 | #66000000
273 | #B8000000
274 | #E6CCCCCC
275 | #E6F2F2F2
276 | #E6E6E6E6
277 | #E6F2F2F2
278 | #E6FFFFFF
279 | #E6767676
280 | #17000000
281 | #2E000000
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 | 2
304 | 2
305 | 2
306 | 1
307 | 1
308 | 1
309 | 1
310 | 1
311 | 1
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
341 |
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 |
369 |
370 |
371 |
372 |
373 |
374 |
375 |
376 |
377 |
378 |
379 |
380 |
381 |
382 |
383 |
384 |
385 |
386 |
387 |
388 |
389 |
390 |
391 |
392 |
393 |
394 |
395 |
396 |
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
406 |
407 |
408 |
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
427 |
428 |
429 |
430 |
431 |
432 |
433 |
434 |
435 |
--------------------------------------------------------------------------------
/FluentDesignSystem/Sketch/SketchTexture.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cnbluefire/FDSforCU/07e13555787bf4f80805d25e5a66d6d7e7487199/FluentDesignSystem/Sketch/SketchTexture.jpg
--------------------------------------------------------------------------------
/FluentDesignSystem/StaticValue.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace FluentDesignSystem
8 | {
9 |
10 | public static class StaticValue
11 | {
12 | #region Handlers
13 | public static bool IsWindowPointerMovedHandled = false;
14 | public static bool IsWindowPointerEnteredHandled = false;
15 | public static bool IsWindowPointerExitedHandled = false;
16 | #endregion
17 |
18 | #region Lights
19 | public static Lights.RevealAmbientLight AmbientLight;
20 | public static Lights.RevealBorderSpotLight BorderLight;
21 | public static Lights.RevealContentSpotLight ContentLight;
22 | #endregion
23 |
24 | #region ChildLights
25 | public static Lights.RevealAmbientLight ChildAmbientLight
26 | {
27 | get => new Lights.RevealAmbientLight();
28 | }
29 | public static Lights.RevealBorderSpotLight ChildBorderLight
30 | {
31 | get => new Lights.RevealBorderSpotLight();
32 | }
33 | public static Lights.RevealContentSpotLight ChildContentLight
34 | {
35 | get => new Lights.RevealContentSpotLight();
36 | }
37 | #endregion
38 |
39 | public static List InPopupGridNameList = new List()
40 | {
41 | "ContentBorder","LayoutRoot","Root"
42 | };
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Fluent Design System for Creators Update V0.2
2 | ==============
3 | Fluent Design System for Creators Update(FDS4CU)是一个UWP的资源库,将Windows10 Fall Creators Update(10.0;版本16299)SDK中的部分效果(Acrylic和Reveal)移植到Windows10 15063中。
4 | 目前支持全部的Acrylic笔刷和Button,ToggleButton,RepeatButton,SemanticZoom,AutoSuggestBox,ComboBox,ListView和GridView的Reveal效果。
5 |
6 | Acrylic笔刷如下(详细参数可见/ResourceDictionarys/ThemeResources.xaml):
7 |
8 | SystemControlAcrylicWindowBrush
9 | SystemControlAcrylicElementBrush
10 | SystemControlAccentAcrylicWindowAccentMediumHighBrush
11 | SystemControlAccentAcrylicElementAccentMediumHighBrush
12 | SystemControlAccentDark1AcrylicWindowAccentDark1Brush
13 | SystemControlAccentDark1AcrylicElementAccentDark1Brush
14 | SystemControlAccentDark2AcrylicWindowAccentDark2MediumHighBrush
15 | SystemControlAccentDark2AcrylicElementAccentDark2MediumHighBrush
16 | SystemControlAcrylicWindowMediumHighBrush
17 | SystemControlAcrylicElementMediumHighBrush
18 | SystemControlAcrylicWindowMediumBrush
19 | SystemControlAcrylicElementMediumBrush
20 | SystemControlChromeMediumLowAcrylicWindowMediumBrush
21 | SystemControlChromeMediumLowAcrylicElementMediumBrush
22 | SystemControlBaseHighAcrylicWindowBrush
23 | SystemControlBaseHighAcrylicElementBrush
24 | SystemControlBaseHighAcrylicWindowMediumHighBrush
25 | SystemControlBaseHighAcrylicElementMediumHighBrush
26 | SystemControlBaseHighAcrylicWindowMediumBrush
27 | SystemControlBaseHighAcrylicElementMediumBrush
28 | SystemControlChromeLowAcrylicWindowBrush
29 | SystemControlChromeLowAcrylicElementBrush
30 | SystemControlChromeMediumAcrylicWindowMediumBrush
31 | SystemControlChromeMediumAcrylicElementMediumBrush
32 | SystemControlChromeHighAcrylicWindowMediumBrush
33 | SystemControlChromeHighAcrylicElementMediumBrush
34 | SystemControlBaseLowAcrylicWindowBrush
35 | SystemControlBaseLowAcrylicElementBrush
36 | SystemControlBaseMediumLowAcrylicWindowMediumBrush
37 | SystemControlBaseMediumLowAcrylicElementMediumBrush
38 | SystemControlAltLowAcrylicWindowBrush
39 | SystemControlAltLowAcrylicElementBrush
40 | SystemControlAltMediumLowAcrylicWindowMediumBrush
41 | SystemControlAltMediumLowAcrylicElementMediumBrush
42 | SystemControlAltHighAcrylicWindowBrush
43 | SystemControlAltHighAcrylicElementBrush
44 |
45 | 开启Acrylic的方法如下:
46 | 在App.xaml中添加:
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 | 引入相关资源字典即可使用所有笔刷。
57 |
58 | ***
59 |
60 | Reveal样式如下(详细参数可见/ResourceDictionarys/Styles.xaml,AutoSuggestBox,ComboBox,ListView和GridView不需多做处理,其他需要设置Style="...RevealStyle"):
61 |
62 | ButtonRevealStyle
63 | RepeatButtonRevealStyle
64 | ToggleButtonRevealStyle
65 | SemanticZoomRevealStyle
66 | AutoSuggestBoxRevealStyle
67 | ComboBoxItemRevealStyle
68 | ListViewItemRevealStyle
69 | GridViewItemRevealStyle
70 |
71 | 自定义控件开启Reveal方式如下:
72 | 首先同上引入资源字典,然后编辑UserControl的VisualState:
73 |
74 |
77 |
78 |
79 |
80 | VisualState x:Name="Normal" />
81 |
82 |
83 |
84 |
89 |
90 |
91 |
92 |
93 |
97 |
98 |
99 |
100 | ...
101 |
102 |
103 | 然后在后台代码中处理VisualState状态转换。
104 |
105 | ***
106 |
107 | 由于SDK接口的局限性,还有一些实现上的问题,Acrylic和Reveal表现并不是太稳定,欢迎大家Fork和反馈。
108 |
109 | By:叫我蓝火火
110 | Blog:[叫我蓝火火](http://www.cnblogs.com/blue-fire/)
111 | 微博:[Blue_Fire蓝火](http://www.weibo.com/2255001067/profile)
--------------------------------------------------------------------------------