From 4ba289f63c4b615ab5b4149f5e8004bf79c0610c Mon Sep 17 00:00:00 2001 From: oZ-Zo <50652175+oz-zo@users.noreply.github.com> Date: Wed, 12 Feb 2020 17:04:15 +0300 Subject: [PATCH] Add toggle switch design --- .../Controls/HamburgerCategoryButton.xaml | 2 +- .../HamburgerCategoryFlashButton.xaml | 2 +- .../W10SS_GUI/Controls/ToggleSwitch.xaml | 208 ++++++++++++++++++ .../W10SS_GUI/Controls/ToggleSwitch.xaml.cs | 42 ++++ .../Controls/TogglesCategoryPanel.xaml | 2 +- W10SS_GUI_2/W10SS_GUI/MainWindow.xaml | 8 +- W10SS_GUI_2/W10SS_GUI/MainWindow.xaml.cs | 2 +- .../W10SS_GUI/Resource/controlsSize.xaml | 8 +- W10SS_GUI_2/W10SS_GUI/Resource/fonts.xaml | 13 +- W10SS_GUI_2/W10SS_GUI/W10SS_GUI.csproj | 7 + 10 files changed, 280 insertions(+), 14 deletions(-) create mode 100644 W10SS_GUI_2/W10SS_GUI/Controls/ToggleSwitch.xaml create mode 100644 W10SS_GUI_2/W10SS_GUI/Controls/ToggleSwitch.xaml.cs diff --git a/W10SS_GUI_2/W10SS_GUI/Controls/HamburgerCategoryButton.xaml b/W10SS_GUI_2/W10SS_GUI/Controls/HamburgerCategoryButton.xaml index aa7bebe3..bd5fe7ed 100644 --- a/W10SS_GUI_2/W10SS_GUI/Controls/HamburgerCategoryButton.xaml +++ b/W10SS_GUI_2/W10SS_GUI/Controls/HamburgerCategoryButton.xaml @@ -56,7 +56,7 @@ - diff --git a/W10SS_GUI_2/W10SS_GUI/Controls/HamburgerCategoryFlashButton.xaml b/W10SS_GUI_2/W10SS_GUI/Controls/HamburgerCategoryFlashButton.xaml index 7fc9d52d..5a960ac3 100644 --- a/W10SS_GUI_2/W10SS_GUI/Controls/HamburgerCategoryFlashButton.xaml +++ b/W10SS_GUI_2/W10SS_GUI/Controls/HamburgerCategoryFlashButton.xaml @@ -67,7 +67,7 @@ - diff --git a/W10SS_GUI_2/W10SS_GUI/Controls/ToggleSwitch.xaml b/W10SS_GUI_2/W10SS_GUI/Controls/ToggleSwitch.xaml new file mode 100644 index 00000000..8c5c8d87 --- /dev/null +++ b/W10SS_GUI_2/W10SS_GUI/Controls/ToggleSwitch.xaml @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/W10SS_GUI_2/W10SS_GUI/Controls/ToggleSwitch.xaml.cs b/W10SS_GUI_2/W10SS_GUI/Controls/ToggleSwitch.xaml.cs new file mode 100644 index 00000000..a9326fd4 --- /dev/null +++ b/W10SS_GUI_2/W10SS_GUI/Controls/ToggleSwitch.xaml.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace W10SS_GUI.Controls +{ + /// + /// Логика взаимодействия для ToggleSwitch.xaml + /// + public partial class ToggleSwitch : UserControl + { + public ToggleSwitch() + { + InitializeComponent(); + } + + + + public bool IsChecked + { + get { return (bool)GetValue(IsCheckedProperty); } + set { SetValue(IsCheckedProperty, value); } + } + + // Using a DependencyProperty as the backing store for IsChecked. This enables animation, styling, binding, etc... + public static readonly DependencyProperty IsCheckedProperty = + DependencyProperty.Register("IsChecked", typeof(bool), typeof(ToggleSwitch), new PropertyMetadata(default(bool))); + + + } +} diff --git a/W10SS_GUI_2/W10SS_GUI/Controls/TogglesCategoryPanel.xaml b/W10SS_GUI_2/W10SS_GUI/Controls/TogglesCategoryPanel.xaml index a202ca79..3557271d 100644 --- a/W10SS_GUI_2/W10SS_GUI/Controls/TogglesCategoryPanel.xaml +++ b/W10SS_GUI_2/W10SS_GUI/Controls/TogglesCategoryPanel.xaml @@ -19,7 +19,7 @@ diff --git a/W10SS_GUI_2/W10SS_GUI/MainWindow.xaml b/W10SS_GUI_2/W10SS_GUI/MainWindow.xaml index c0818b93..01ed9607 100644 --- a/W10SS_GUI_2/W10SS_GUI/MainWindow.xaml +++ b/W10SS_GUI_2/W10SS_GUI/MainWindow.xaml @@ -11,7 +11,7 @@ MinWidth="{StaticResource windowMinWidth}" Height="{StaticResource windowHeight}" Width="{StaticResource windowWidth}" - FontFamily="{StaticResource windowFontFamily}" + FontFamily="{StaticResource fontWindow}" FontSize="{DynamicResource windowFontSize}" TextOptions.TextFormattingMode="Display" WindowStartupLocation="CenterScreen" SnapsToDevicePixels="True" ResizeMode="CanResize" ShowInTaskbar="True" @@ -148,7 +148,8 @@ - + - - + diff --git a/W10SS_GUI_2/W10SS_GUI/MainWindow.xaml.cs b/W10SS_GUI_2/W10SS_GUI/MainWindow.xaml.cs index d56df08a..21a9820b 100644 --- a/W10SS_GUI_2/W10SS_GUI/MainWindow.xaml.cs +++ b/W10SS_GUI_2/W10SS_GUI/MainWindow.xaml.cs @@ -24,7 +24,7 @@ namespace W10SS_GUI { public MainWindow() { - InitializeComponent(); + InitializeComponent(); } private void Window_Initialized(object sender, EventArgs e) diff --git a/W10SS_GUI_2/W10SS_GUI/Resource/controlsSize.xaml b/W10SS_GUI_2/W10SS_GUI/Resource/controlsSize.xaml index 84b787e4..200c539e 100644 --- a/W10SS_GUI_2/W10SS_GUI/Resource/controlsSize.xaml +++ b/W10SS_GUI_2/W10SS_GUI/Resource/controlsSize.xaml @@ -21,6 +21,12 @@ 40 20 + 500 + 70 + 24 + 25 + 55 + + - \ No newline at end of file diff --git a/W10SS_GUI_2/W10SS_GUI/Resource/fonts.xaml b/W10SS_GUI_2/W10SS_GUI/Resource/fonts.xaml index b0977018..2934621c 100644 --- a/W10SS_GUI_2/W10SS_GUI/Resource/fonts.xaml +++ b/W10SS_GUI_2/W10SS_GUI/Resource/fonts.xaml @@ -3,9 +3,12 @@ xmlns:local="clr-namespace:W10SS_GUI.Resource" xmlns:system="clr-namespace:System;assembly=mscorlib"> - Calibri - Segoe MDL2 Assets - Segoe MDL2 Assets - Segoe UI - + Calibri + Segoe MDL2 Assets + Segoe MDL2 Assets + Segoe UI + + Segoe MDL2 Assets + Calibri + \ No newline at end of file diff --git a/W10SS_GUI_2/W10SS_GUI/W10SS_GUI.csproj b/W10SS_GUI_2/W10SS_GUI/W10SS_GUI.csproj index d3c9956a..9b4385ef 100644 --- a/W10SS_GUI_2/W10SS_GUI/W10SS_GUI.csproj +++ b/W10SS_GUI_2/W10SS_GUI/W10SS_GUI.csproj @@ -75,6 +75,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -116,6 +120,9 @@ TogglesCategoryPanel.xaml + + ToggleSwitch.xaml + MainWindow.xaml Code