2
0

Add project files.

This commit is contained in:
DangHome
2022-05-23 00:58:58 +08:00
parent e5a279a1fd
commit f0b02be1a5
51 changed files with 3090 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
<Application x:Class="CMM.Management.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:CMM.Management"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Style/Color.xaml"/>
<ResourceDictionary Source="Images/icons.xaml"/>
<ResourceDictionary Source="Style/Slider.xaml"/>
<ResourceDictionary Source="Style/Btn.xaml"/>
<ResourceDictionary Source="Style/Main.xaml"/>
<ResourceDictionary Source="Style/MonCtrlStyle.xaml"/>
<ResourceDictionary Source="Style/MonitorsControlStyle.xaml"/>
<ResourceDictionary Source="/Language;component/StringResources.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

View File

@@ -0,0 +1,34 @@
using CMM.Library.Config;
using CMM.Library.Method;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace CMM.Management
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
internal static XConfig cfg { get; private set; }
internal static CMMMgr CMMMgr { get; private set; }
public App()
{
//cfg = new();
//cfg.Load();
CMMMgr = new CMMMgr();
Startup += async (s, e) => await App_Startup(s, e);
}
private async Task App_Startup(object sender, StartupEventArgs e)
{
await CMMMgr.Init();
}
}
}

View File

@@ -0,0 +1,10 @@
using System.Windows;
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

View File

@@ -0,0 +1,137 @@
<UserControl x:Class="CMM.Management.Control.Loading"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:CMM.Management.Control"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<Color x:Key="FilledColor" A="255" B="155" R="155" G="155"/>
<Color x:Key="UnfilledColor" A="0" B="155" R="155" G="155"/>
<Style x:Key="BusyAnimationStyle" TargetType="Control">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Control">
<ControlTemplate.Resources>
<Storyboard x:Key="Animation0" BeginTime="00:00:00.0" RepeatBehavior="Forever">
<ColorAnimationUsingKeyFrames Storyboard.TargetName="ellipse0" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
<SplineColorKeyFrame KeyTime="00:00:00.0" Value="{StaticResource FilledColor}"/>
<SplineColorKeyFrame KeyTime="00:00:01.6" Value="{StaticResource UnfilledColor}"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="Animation1" BeginTime="00:00:00.2" RepeatBehavior="Forever">
<ColorAnimationUsingKeyFrames Storyboard.TargetName="ellipse1" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
<SplineColorKeyFrame KeyTime="00:00:00.0" Value="{StaticResource FilledColor}"/>
<SplineColorKeyFrame KeyTime="00:00:01.6" Value="{StaticResource UnfilledColor}"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="Animation2" BeginTime="00:00:00.4" RepeatBehavior="Forever">
<ColorAnimationUsingKeyFrames Storyboard.TargetName="ellipse2" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
<SplineColorKeyFrame KeyTime="00:00:00.0" Value="{StaticResource FilledColor}"/>
<SplineColorKeyFrame KeyTime="00:00:01.6" Value="{StaticResource UnfilledColor}"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="Animation3" BeginTime="00:00:00.6" RepeatBehavior="Forever">
<ColorAnimationUsingKeyFrames Storyboard.TargetName="ellipse3" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
<SplineColorKeyFrame KeyTime="00:00:00.0" Value="{StaticResource FilledColor}"/>
<SplineColorKeyFrame KeyTime="00:00:01.6" Value="{StaticResource UnfilledColor}"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="Animation4" BeginTime="00:00:00.8" RepeatBehavior="Forever">
<ColorAnimationUsingKeyFrames Storyboard.TargetName="ellipse4" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
<SplineColorKeyFrame KeyTime="00:00:00.0" Value="{StaticResource FilledColor}"/>
<SplineColorKeyFrame KeyTime="00:00:01.6" Value="{StaticResource UnfilledColor}"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="Animation5" BeginTime="00:00:01.0" RepeatBehavior="Forever">
<ColorAnimationUsingKeyFrames Storyboard.TargetName="ellipse5" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
<SplineColorKeyFrame KeyTime="00:00:00.0" Value="{StaticResource FilledColor}"/>
<SplineColorKeyFrame KeyTime="00:00:01.6" Value="{StaticResource UnfilledColor}"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="Animation6" BeginTime="00:00:01.2" RepeatBehavior="Forever">
<ColorAnimationUsingKeyFrames Storyboard.TargetName="ellipse6" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
<SplineColorKeyFrame KeyTime="00:00:00.0" Value="{StaticResource FilledColor}"/>
<SplineColorKeyFrame KeyTime="00:00:01.6" Value="{StaticResource UnfilledColor}"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="Animation7" BeginTime="00:00:01.4" RepeatBehavior="Forever">
<ColorAnimationUsingKeyFrames Storyboard.TargetName="ellipse7" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
<SplineColorKeyFrame KeyTime="00:00:00.0" Value="{StaticResource FilledColor}"/>
<SplineColorKeyFrame KeyTime="00:00:01.6" Value="{StaticResource UnfilledColor}"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>
</ControlTemplate.Resources>
<ControlTemplate.Triggers>
<Trigger Property="IsVisible" Value="True">
<Trigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource Animation0}" x:Name="Storyboard0" />
<BeginStoryboard Storyboard="{StaticResource Animation1}" x:Name="Storyboard1"/>
<BeginStoryboard Storyboard="{StaticResource Animation2}" x:Name="Storyboard2"/>
<BeginStoryboard Storyboard="{StaticResource Animation3}" x:Name="Storyboard3"/>
<BeginStoryboard Storyboard="{StaticResource Animation4}" x:Name="Storyboard4"/>
<BeginStoryboard Storyboard="{StaticResource Animation5}" x:Name="Storyboard5"/>
<BeginStoryboard Storyboard="{StaticResource Animation6}" x:Name="Storyboard6"/>
<BeginStoryboard Storyboard="{StaticResource Animation7}" x:Name="Storyboard7"/>
</Trigger.EnterActions>
<Trigger.ExitActions>
<StopStoryboard BeginStoryboardName="Storyboard0"/>
<StopStoryboard BeginStoryboardName="Storyboard1"/>
<StopStoryboard BeginStoryboardName="Storyboard2"/>
<StopStoryboard BeginStoryboardName="Storyboard3"/>
<StopStoryboard BeginStoryboardName="Storyboard4"/>
<StopStoryboard BeginStoryboardName="Storyboard5"/>
<StopStoryboard BeginStoryboardName="Storyboard6"/>
<StopStoryboard BeginStoryboardName="Storyboard7"/>
</Trigger.ExitActions>
</Trigger>
</ControlTemplate.Triggers>
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
<Grid>
<Canvas Height="60" Width="60">
<Canvas.Resources>
<Style TargetType="Ellipse">
<Setter Property="Width" Value="15"/>
<Setter Property="Height" Value="15" />
<Setter Property="Fill" Value="#009B9B9B" />
</Style>
</Canvas.Resources>
<Ellipse x:Name="ellipse0" Canvas.Left="1.75" Canvas.Top="21"/>
<Ellipse x:Name="ellipse1" Canvas.Top="7" Canvas.Left="6.5"/>
<Ellipse x:Name="ellipse2" Canvas.Left="20.5" Canvas.Top="0.75"/>
<Ellipse x:Name="ellipse3" Canvas.Left="34.75" Canvas.Top="6.75"/>
<Ellipse x:Name="ellipse4" Canvas.Left="40.5" Canvas.Top="20.75" />
<Ellipse x:Name="ellipse5" Canvas.Left="34.75" Canvas.Top="34.5"/>
<Ellipse x:Name="ellipse6" Canvas.Left="20.75" Canvas.Top="39.75"/>
<Ellipse x:Name="ellipse7" Canvas.Top="34.25" Canvas.Left="7" />
<Ellipse Width="39.5" Height="39.5" Canvas.Left="8.75" Canvas.Top="8" Visibility="Hidden"/>
</Canvas>
<Label Content="{Binding Path=Text}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Grid>
<Control Style="{StaticResource BusyAnimationStyle}"/>
<Border Background="#AA424242">
<Border.Effect>
<BlurEffect Radius="50" KernelType="Gaussian" RenderingBias="Quality"/>
</Border.Effect>
</Border>
</Grid>
</UserControl>

View File

@@ -0,0 +1,28 @@
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 CMM.Management.Control
{
/// <summary>
/// Interaction logic for Loading.xaml
/// </summary>
public partial class Loading : UserControl
{
public Loading()
{
InitializeComponent();
}
}
}

View File

@@ -0,0 +1,55 @@
using System.Windows.Controls;
using System.Windows;
using CMM.Library.ViewModel;
using CMM.Library.Base;
using CMM.Library.Method;
using System.Windows.Data;
using System;
namespace CMM.Management.Control
{
/// <summary>
/// 單一顆螢幕
/// </summary>
internal class MonCtrl : System.Windows.Controls.Control
{
public readonly static DependencyProperty MonProperty;
private StackPanel _sp;
static MonCtrl()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(MonCtrl), new FrameworkPropertyMetadata(typeof(MonCtrl)));
MonProperty = DependencyProperty.Register(
"Monitor",
typeof(XMonitor),
typeof(MonCtrl),
new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnMonChangedCallback));
}
public override void OnApplyTemplate()
{
_sp = Template.FindName("sp", this) as StackPanel;
}
public XMonitor Mon
{
get => (XMonitor)GetValue(MonProperty);
set => SetValue(MonProperty, value);
}
static void OnMonChangedCallback(DependencyObject sender, DependencyPropertyChangedEventArgs args)
{
var me = sender as MonCtrl;
if (me != null)
{
me.OnMonChanged((XMonitor)args.NewValue);
}
}
public virtual void OnMonChanged(XMonitor value)
{
}
}
}

View File

@@ -0,0 +1,61 @@
using System.Windows.Controls;
using System.Windows;
using CMM.Library.ViewModel;
using CMM.Library.Base;
using CMM.Library.Method;
using System.Windows.Data;
using System;
namespace CMM.Management.Control
{
/// <summary>
/// 全部螢幕
/// </summary>
internal class MonitorsControl : System.Windows.Controls.Control
{
public readonly static DependencyProperty MonitorsProperty;
private StackPanel _sp;
static MonitorsControl()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(MonitorsControl), new FrameworkPropertyMetadata(typeof(MonitorsControl)));
MonitorsProperty = DependencyProperty.Register(
"Monitors",
typeof(ObservableRangeCollection<XMonitor>),
typeof(MonitorsControl),
new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnMonitorsChangedCallback));
}
public override void OnApplyTemplate()
{
_sp = Template.FindName("sp", this) as StackPanel;
}
public ObservableRangeCollection<XMonitor> Monitors
{
get => (ObservableRangeCollection<XMonitor>)GetValue(MonitorsProperty);
set => SetValue(MonitorsProperty, value);
}
static void OnMonitorsChangedCallback(DependencyObject sender, DependencyPropertyChangedEventArgs args)
{
var me = sender as MonitorsControl;
if (me != null)
{
me.OnMonitorsChanged((ObservableRangeCollection<XMonitor>)args.NewValue);
}
}
public virtual void OnMonitorsChanged(ObservableRangeCollection<XMonitor> value)
{
foreach (var mon in value)
{
var monCtrl = new MonCtrl();
monCtrl.Mon = mon;
_sp.Children.Add(monCtrl);
}
}
}
}

View File

@@ -0,0 +1,66 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<RootNamespace>CMM.Management</RootNamespace>
<UseWPF>true</UseWPF>
<Copyright>Copyright © DangWang $([System.DateTime]::Now.ToString(yyyy))</Copyright>
<Company>Dang</Company>
<Product>ControlMyMonitorManagement</Product>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Resource\**" />
<EmbeddedResource Remove="Resource\**" />
<None Remove="Resource\**" />
<Page Remove="Resource\**" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Language\Language.csproj" />
<ProjectReference Include="..\Library\Library.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Converter\" />
<Folder Include="Form\" />
</ItemGroup>
<ItemGroup>
<Page Update="Images\icons.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
<Page Update="Style\Btn.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
<Page Update="Style\Color.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
<Page Update="Style\Main.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
<Page Update="Style\Slider.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<Major>1</Major>
<Minor>0</Minor>
<ProjectStartedDate>$([System.DateTime]::op_Subtraction($([System.DateTime]::get_Now().get_Date()),$([System.DateTime]::new(2017,9,17))).get_TotalDays())</ProjectStartedDate>
<DaysSinceProjectStarted>$([System.DateTime]::Now.ToString(Hmm))</DaysSinceProjectStarted>
<DateTimeSuffix>$([System.DateTime]::Now.ToString(yyyyMMdd))</DateTimeSuffix>
<VersionSuffix>$(Major).$(Minor).$(ProjectStartedDate).$(DaysSinceProjectStarted)</VersionSuffix>
<AssemblyVersion Condition=" '$(DateTimeSuffix)' == '' ">0.0.0.1</AssemblyVersion>
<AssemblyVersion Condition=" '$(DateTimeSuffix)' != '' ">$(VersionSuffix)</AssemblyVersion>
<Version Condition=" '$(DateTimeSuffix)' == '' ">0.0.0.1</Version>
<Version Condition=" '$(DateTimeSuffix)' != '' ">$(DateTimeSuffix)</Version>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,64 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style x:Key="PathFill" TargetType="Path">
<Setter Property="Stretch" Value="Uniform"/>
<Setter Property="Fill" Value="{Binding RelativeSource={RelativeSource AncestorType=Button}, Path=Foreground}"/>
</Style>
<!--Path Clear-->
<Style x:Key="PathClear" TargetType="Path" BasedOn="{StaticResource PathFill}">
<Setter Property="Data" Value="F1 M512.262,512.262z M0,0z M507.736,4.394C501.879,-1.464,492.381,-1.464,486.523,4.394L289.873,201.044C253.003,171.95,199.405,174.084,164.993,207.448L6.44799999999995,319.984C-1.14300000000005,325.372,-2.02300000000005,336.276,4.52399999999995,342.822L169.573,507.871C176.308,514.607,187.552,513.432,192.749,505.45L299.494,341.53C330.826,309.012,334.421,259.504,310.24,223.103L507.736,25.6070000000001C513.594,19.7490000000001,513.594,10.2520000000001,507.736,4.39400000000006z M231.09,210.647C281.881,210.647,313.086,266.533,286.424,309.767L196.958,220.301C207.115,214.011,218.844,210.647,231.09,210.647z M177.704,473.576L153.344,449.216 196.61,384.321C201.206,377.428 199.343,368.115 192.45,363.52 185.559,358.924 176.245,360.787 171.649,367.68L131.711,427.584 38.295,334.168 172.874,238.644 268.453,334.223z"/>
</Style>
<!--Path Unlock-->
<Style x:Key="PathUnlock" TargetType="Path" BasedOn="{StaticResource PathFill}">
<Setter Property="Data" Value="F1 M438.533,438.533z M0,0z M375.721,227.259C370.39,221.928,363.921,219.267,356.304,219.267L146.176,219.267 146.176,127.907C146.176,107.728 153.315,90.505 167.591,76.229 181.868,61.956 199.092,54.818 219.269,54.818 239.444,54.818 256.671,61.955 270.942,76.229 285.219,90.505 292.358,107.729 292.358,127.907 292.358,132.854 294.165,137.136 297.778,140.752 301.399,144.369 305.683,146.178 310.625,146.178L328.906,146.178C333.851,146.178 338.133,144.369 341.754,140.752 345.36,137.136 347.174,132.854 347.174,127.907 347.174,92.691 334.659,62.576 309.633,37.545 284.603,12.513 254.48,0 219.269,0 184.055,0 153.935,12.513 128.903,37.544 103.875,62.572 91.361,92.69 91.361,127.906L91.361,219.266 82.226,219.266C74.615,219.266 68.142,221.933 62.812,227.258 57.482,232.583 54.818,239.058 54.818,246.672L54.818,411.124C54.818,418.741 57.483,425.213 62.812,430.541 68.142,435.866 74.615,438.532 82.226,438.532L356.304,438.532C363.921,438.532 370.396,435.866 375.721,430.541 381.046,425.213 383.715,418.741 383.715,411.124L383.715,246.673C383.719,239.059,381.053,232.591,375.721,227.259z"/>
</Style>
<!--Path Lock-->
<Style x:Key="PathLock" TargetType="Path" BasedOn="{StaticResource PathFill}">
<Setter Property="Data" Value="F1 M384,512z M0,0z M174.95,0L209.07,0C224.28,2.59 239.57,5.85 253.68,12.31 300.63,34.12 336.58,80.78 340.89,132.98 340.88,138.35 341.93,143.64 342.03,149 341.97,184.67 342,220.33 342.01,256 349.9,256.34 358.3,254.71 365.7,258.28 374.66,262.65 381.66,271.03 384,280.78L384,487.24C381.12,499.22,371.21,509.14,359.22,512L24.76,512C12.78,509.12,2.87,499.21,0,487.22L0,280.76C2.35,271.02 9.34,262.65 18.3,258.28 25.7,254.71 34.09,256.34 41.99,256 41.99,220.33 42.03,184.67 41.97,149 42.07,143.64 43.12,138.35 43.11,132.97 47.42,80.78 83.37,34.12 130.32,12.31 144.43,5.85 159.73,2.59 174.95,0 M107.18,144.03C106.76,181.33 107.12,218.67 107.01,255.99 163.67,256.01 220.33,256 276.99,255.99 277.02,221.33 276.97,186.66 277.02,152 277.29,133.15 271.81,113.9 260.01,99 244.53,77.81 218.55,63.57 192,65.01 148.56,62.76 109.21,101.17 107.18,144.03z"/>
</Style>
<!--Path Log-->
<Style x:Key="PathLog1" TargetType="Path" BasedOn="{StaticResource PathFill}">
<Setter Property="Data" Value="F1 M551.13,551.13z M0,0z M275.531,172.228L275.481,292.721C275.481,297.296,277.297,301.669,280.527,304.898L366.725,391.079 391.079,366.725 309.926,285.589 309.976,172.228z"/>
</Style>
<Style x:Key="PathLog2" TargetType="Path" BasedOn="{StaticResource PathFill}">
<Setter Property="Data" Value="F1 M551.13,551.13z M0,0z M310.011,34.445C188.781,34.445,88.448,124.478,71.644,241.119L2.8421709430404E-14,241.119 86.114,327.233 172.228,241.119 106.448,241.119C122.925,143.53 207.803,68.891 310.011,68.891 423.977,68.891 516.685,161.598 516.685,275.565 516.685,389.532 423.978,482.239 310.011,482.239 245.947,482.239 186.542,453.243 147.033,402.684L119.887,423.876C165.971,482.844 235.266,516.684 310.011,516.684 442.966,516.684 551.13,408.503 551.13,275.565 551.13,142.627 442.966,34.4460000000001 310.011,34.4450000000001z"/>
</Style>
<!--Path General-->
<Style x:Key="PathGeneral" TargetType="Path" BasedOn="{StaticResource PathFill}">
<Setter Property="Data" Value="F1 M512,512z M0,0z M452,36L60,36C26.916,36,0,62.916,0,96L0,336C0,369.084,26.916,396,60,396L236,396 236,436 132,436 132,476 380,476 380,436 276,436 276,396 452,396C485.084,396,512,369.084,512,336L512,96C512,62.916,485.084,36,452,36z M472,336C472,347.028,463.028,356,452,356L60,356C48.972,356,40,347.028,40,336L40,96C40,84.972,48.972,76,60,76L452,76C463.028,76,472,84.972,472,96L472,336z"/>
</Style>
<!--Path Setting-->
<Style x:Key="PathSetting" TargetType="Path" BasedOn="{StaticResource PathFill}">
<Setter Property="Stretch" Value="UniformToFill"/>
<Setter Property="Data" Value="F1 M24,24z M0,0z M22.683,9.394L20.803,9.155C20.648,8.678,20.457,8.218,20.234,7.781L21.395,6.286C21.865,5.681,21.81,4.827,21.273,4.307L19.698,2.732C19.173,2.19,18.319,2.136,17.713,2.605L16.22,3.766C15.783,3.543,15.323,3.352,14.845,3.197L14.606,1.32C14.516,0.566999999999999,13.877,-1.33226762955019E-15,13.12,-1.33226762955019E-15L10.88,-1.33226762955019E-15C10.123,-1.33226762955019E-15,9.48400000000001,0.566999999999999,9.394,1.317L9.155,3.197C8.677,3.352,8.217,3.542,7.78,3.766L6.286,2.605C5.682,2.136,4.828,2.19,4.307,2.727L2.732,4.301C2.19,4.827,2.135,5.681,2.605,6.287L3.766,7.781C3.542,8.218,3.352,8.678,3.197,9.155L1.32,9.394C0.567000000000003,9.484,3.10862446895044E-15,10.123,3.10862446895044E-15,10.88L3.10862446895044E-15,13.12C3.10862446895044E-15,13.877,0.567000000000003,14.516,1.317,14.606L3.197,14.845C3.352,15.322,3.543,15.782,3.766,16.219L2.605,17.714C2.135,18.319,2.19,19.173,2.727,19.693L4.302,21.268C4.828,21.809,5.681,21.863,6.287,21.394L7.781,20.233C8.218,20.457,8.678,20.648,9.155,20.802L9.394,22.678C9.484,23.433,10.123,24,10.88,24L13.12,24C13.877,24,14.516,23.433,14.606,22.683L14.845,20.803C15.322,20.648,15.782,20.457,16.219,20.234L17.714,21.395C18.319,21.865,19.173,21.81,19.693,21.273L21.268,19.698C21.81,19.172,21.865,18.319,21.395,17.713L20.234,16.219C20.458,15.782,20.649,15.322,20.803,14.845L22.679,14.606C23.432,14.516,23.999,13.877,23.999,13.12L23.999,10.88C24,10.123,23.433,9.484,22.683,9.394z M12,17C9.243,17 7,14.757 7,12 7,9.243 9.243,7 12,7 14.757,7 17,9.243 17,12 17,14.757 14.757,17 12,17z"/>
</Style>
<!--Path Frame-->
<Style x:Key="PathFrame" TargetType="Path" BasedOn="{StaticResource PathFill}">
<Setter Property="Data" Value="F1 M512,512z M0,0z M94.22,0L417.79,0C441.21,0.19 464.38,9.46 481.47,25.48 500.23,42.75 511.5,67.76 512,93.26L512,420.97C510.85,442.12 502.78,462.87 488.82,478.86 471.32,499.41 444.76,511.82 417.76,512L94.27,512C73.21,511.75 52.27,504.36 35.88,491.09 14,473.85 0.5,446.62 0,418.76L0,93.25C0.49,68.71 10.9,44.57 28.49,27.46 45.77,10.27 69.85,0.21 94.22,0 M85.61,30.72C68.33,33.24 52.3,43.14 42.24,57.39 34.1,68.48 29.86,82.28 30,96 30,202.67 30,309.34 30,416.01 29.89,427.61 32.9,439.23 38.74,449.26 48.08,465.41 64.52,477.36 82.9,480.79 90.5,482.38 98.29,481.94 105.99,482 209.31,482 312.63,482 415.95,482 422.69,482.03 429.44,481.08 435.89,479.11 457.54,472.56 475.05,454 480.17,431.95 482.47,423.13 481.96,413.95 482,404.92 481.99,301.59 482.02,198.26 481.99,94.93 481.99,76.98 474.07,59.28 460.78,47.24 449.05,36.27 433.08,30.04 417.03,30.01 310.01,29.99 202.99,30.01 95.97,30 92.5,30 89.03,30.22 85.61,30.72z"/>
</Style>
<!--Path Cancel-->
<Style x:Key="PathCancel" TargetType="Path" BasedOn="{StaticResource PathFill}">
<Setter Property="Data" Value="F1 M512,512z M0,0z M140.12,139.14C143.16,135.89 148.82,135.93 151.84,139.19 186.95,174.18 221.94,209.28 257.01,244.31 292.08,209.28 327.09,174.2 362.17,139.18 365.35,135.72 371.42,135.97 374.34,139.64 377.33,142.99 376.7,148.52 373.32,151.38 338.46,186.26 303.57,221.12 268.71,256 302.75,290.06 336.8,324.1 370.86,358.15 372.76,360.13 375.18,361.97 375.82,364.8 376.9,368.58 374.74,372.93 371.1,374.4 367.94,375.84 364.03,374.92 361.71,372.38 326.81,337.48 291.93,302.57 257.01,267.69 222.11,302.57 187.25,337.49 152.32,372.35 149.49,375.62 144.11,376.17 140.81,373.3 137.14,370.45 136.79,364.43 140.16,361.21 175.17,326.1 210.28,291.08 245.32,256 210.29,220.92 175.2,185.9 140.18,150.82 136.94,147.81 136.9,142.18 140.12,139.14z"/>
</Style>
<!--Path Minimized-->
<Style x:Key="PathMinimized" TargetType="Path" BasedOn="{StaticResource PathFill}">
<Setter Property="Data" Value="F1 M512,512z M0,0z M107.38,241.56C108.86,241.12 110.41,241.03 111.95,241 207.98,241 304.01,241 400.05,241 407.85,240.59 415.24,247.15 415.52,255.01 416.16,261.91 411.26,268.64 404.62,270.43 401.48,271.29 398.2,270.94 395,271.01 300.65,270.99 206.3,271.01 111.95,271 104.15,271.4 96.76,264.84 96.48,256.99 95.83,250.08 100.74,243.35 107.38,241.56z"/>
</Style>
<!--Path Tick-->
<Style x:Key="PathTick" TargetType="Path" BasedOn="{StaticResource PathFill}">
<Setter Property="Data" Value="F1 M512,512z M0,0z M467.87,75.93C474.86,68.5 486.42,65.9 495.87,69.83 504.86,73.26 511.2,82.14 512,91.67L512,94.74C511.77,102.86 507.06,109.91 501.13,115.11 394.1,222.11 287.11,329.15 180.07,436.14 173.06,443.53 161.52,446.07 152.09,442.16 147.71,440.52 144.16,437.35 140.99,434.01 96.51,389.49 51.98,345.02 7.5,300.49 3.03,296.06 0.4,289.97 0,283.71L0,281.25C0.38,270.52 8.2,260.69 18.52,257.82 27.27,255.24 37.31,257.78 43.69,264.32 83.02,303.59 122.28,342.92 161.6,382.19 263.7,280.11 365.77,178.01 467.87,75.93z"/>
</Style>
</ResourceDictionary>

View File

@@ -0,0 +1,38 @@
<Window x:Class="CMM.Management.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ctrl="clr-namespace:CMM.Management.Control"
xmlns:local="clr-namespace:CMM.Management"
mc:Ignorable="d"
Title="ControlMyMonitor Management"
Background="#666C6161"
AllowsTransparency="True"
ResizeMode="CanResizeWithGrip"
WindowStyle="None"
BorderThickness="3"
BorderBrush="Gray"
WindowStartupLocation="CenterScreen"
Loaded="Window_Loaded" Closing="Window_Closing" MaxWidth="800" ScrollViewer.VerticalScrollBarVisibility="Disabled" UseLayoutRounding="False" MinWidth="550" MinHeight="310">
<Grid x:Name="MianGrid">
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="*"/>
<RowDefinition Height="50"/>
</Grid.RowDefinitions>
<Border Background="#33000000" Grid.Row="2"/>
<Border MouseLeftButtonDown="move" Background="#00000000" Grid.RowSpan="3"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="5">
<Button Click="Btn_Click" Tag="Minimized" Style="{StaticResource MinimizedButton}"/>
<Button Click="Btn_Click" Tag="Exit" Style="{StaticResource CancelButton}"/>
</StackPanel>
<ctrl:MonitorsControl Monitors="{Binding Monitors}" Grid.Row="1"/>
<!--最下層Loading頁面阻擋-->
<Border x:Name="loading" Background="#00000000" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.RowSpan="3" Visibility="Hidden">
<ctrl:Loading />
</Border>
</Grid>
</Window>

View File

@@ -0,0 +1,87 @@
using CMM.Library.WinAPI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
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.Interop;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace CMM.Management
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
EnableBlur();
this.DataContext = App.CMMMgr;
}
#region
private void EnableBlur()
{
var windowHelper = new WindowInteropHelper(this);
var accent = new AccentPolicy();
accent.AccentState = AccentState.ACCENT_ENABLE_BLURBEHIND;
var accentStructSize = Marshal.SizeOf(accent);
var accentPtr = Marshal.AllocHGlobal(accentStructSize);
Marshal.StructureToPtr(accent, accentPtr, false);
var data = new WindowCompositionAttributeData();
data.Attribute = WindowCompositionAttribute.WCA_ACCENT_POLICY;
data.SizeOfData = accentStructSize;
data.Data = accentPtr;
Win32.SetWindowCompositionAttribute(windowHelper.Handle, ref data);
Marshal.FreeHGlobal(accentPtr);
}
#endregion
private void move(object sender, MouseButtonEventArgs e) => DragMove();
private void Btn_Click(object sender, RoutedEventArgs e)
{
var tag = (sender as FrameworkElement).Tag.ToString();
switch (tag)
{
case "Exit":
Deconstruct();
break;
case "Minimized":
this.WindowState = WindowState.Minimized;
break;
default:
break;
}
}
private void Deconstruct()
{
Environment.Exit(0);
}
}
}

View File

@@ -0,0 +1,59 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style x:Key="ImageButton" TargetType="{x:Type ButtonBase}" BasedOn="{x:Null}">
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Style.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Cursor" Value="Hand" />
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="GeometryButton" TargetType="{x:Type ButtonBase}" BasedOn="{StaticResource ImageButton}">
<Setter Property="Foreground" Value="White" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="{StaticResource H1}"/>
</Trigger>
</Style.Triggers>
</Style>
<!--Btn Cancel-->
<Style x:Key="CancelButton" TargetType="{x:Type ButtonBase}" BasedOn="{StaticResource GeometryButton}">
<Setter Property="Margin" Value="3,0,0,0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border>
<Grid Background="{StaticResource AlphaBrush}">
<Path Style="{StaticResource PathCancel}"/>
<Path Style="{StaticResource PathFrame}"/>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--Btn Minimized-->
<Style x:Key="MinimizedButton" TargetType="{x:Type ButtonBase}" BasedOn="{StaticResource GeometryButton}">
<Setter Property="Margin" Value="3,0,0,0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border>
<Grid Background="{StaticResource AlphaBrush}">
<Path Style="{StaticResource PathMinimized}"/>
<Path Style="{StaticResource PathFrame}"/>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

View File

@@ -0,0 +1,39 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Color x:Key="H1Color">#C1272C</Color>
<Color x:Key="H2Color">#66424242</Color>
<Color x:Key="H3Color">#535353</Color>
<Color x:Key="F1Color">#232323</Color>
<Color x:Key="F2Color">#8A3D40</Color>
<Color x:Key="F3Color">#FFFFFF</Color>
<Color x:Key="DisableColor">#B2626262</Color>
<Color x:Key="DisableH2Color">#CCADADAD</Color>
<Color x:Key="NormalGray">#FF686868</Color>
<SolidColorBrush x:Key="NormalForeground" Color="White" />
<SolidColorBrush x:Key="Unexplainable" Color="{StaticResource F2Color}" />
<SolidColorBrush x:Key="Unnecessary" Color="#a08b72" />
<SolidColorBrush x:Key="Selected" Color="{StaticResource H2Color}" />
<SolidColorBrush x:Key="Title" Color="White" />
<SolidColorBrush x:Key="H1" Color="{StaticResource H1Color}" />
<SolidColorBrush x:Key="H2" Color="{StaticResource H2Color}" />
<SolidColorBrush x:Key="H3" Color="{StaticResource H3Color}" />
<SolidColorBrush x:Key="F1" Color="{StaticResource F1Color}" />
<SolidColorBrush x:Key="F2" Color="{StaticResource F2Color}" />
<SolidColorBrush x:Key="F3" Color="{StaticResource F3Color}" />
<SolidColorBrush x:Key="BlurBrush" Color="#CC6C6161" />
<SolidColorBrush x:Key="AlphaBrush" Color="#00FFFFFF" />
<SolidColorBrush x:Key="NormalBrush" Color="{StaticResource NormalGray}" />
<SolidColorBrush x:Key="DisabledForegroundBrush" Color="{StaticResource DisableColor}" />
</ResourceDictionary>

View File

@@ -0,0 +1,4 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary>

View File

@@ -0,0 +1,18 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:CMM.Management.Control">
<Style TargetType="{x:Type local:MonCtrl}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:MonCtrl}">
<StackPanel x:Name="sp" Orientation="Horizontal" HorizontalAlignment="Left">
<TextBlock Text="{Binding Mon.MonitorName, Mode=OneWay, NotifyOnSourceUpdated=True, NotifyOnValidationError=True,
RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:MonCtrl}}}"/>
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

View File

@@ -0,0 +1,17 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:CMM.Management.Control">
<Style TargetType="{x:Type local:MonitorsControl}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:MonitorsControl}">
<StackPanel x:Name="sp" Orientation="Horizontal" HorizontalAlignment="Left">
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

View File

@@ -0,0 +1,278 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style x:Key="SliderRepeatButton" TargetType="RepeatButton">
<Setter Property="SnapsToDevicePixels" Value="true" />
<Setter Property="OverridesDefaultStyle" Value="true" />
<Setter Property="IsTabStop" Value="false" />
<Setter Property="Focusable" Value="false" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RepeatButton">
<Border BorderThickness="1" BorderBrush="{x:Null}" Background="#CCB9B6B6" Height="4"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="SliderRepeatButton1" TargetType="RepeatButton">
<Setter Property="SnapsToDevicePixels" Value="true" />
<Setter Property="OverridesDefaultStyle" Value="true" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RepeatButton">
<Border SnapsToDevicePixels="True" BorderThickness="1" Height="4">
<Border.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="{DynamicResource H2Color}"/>
<GradientStop Color="{DynamicResource H3Color}" Offset="1"/>
</LinearGradientBrush>
</Border.Background>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="SliderThumb" TargetType="Thumb">
<Setter Property="SnapsToDevicePixels" Value="true" />
<Setter Property="OverridesDefaultStyle" Value="true" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Thumb">
<Ellipse Height="12" Width="12" Fill="#99FFFFFF"></Ellipse>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<ControlTemplate x:Key="Slider" TargetType="Slider">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto" MinHeight="{TemplateBinding MinHeight}"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Track Grid.Row="1" x:Name="PART_Track">
<Track.DecreaseRepeatButton>
<RepeatButton Style="{StaticResource SliderRepeatButton1}" Command="Slider.DecreaseLarge" />
</Track.DecreaseRepeatButton>
<Track.Thumb>
<Thumb Style="{StaticResource SliderThumb}"/>
</Track.Thumb>
<Track.IncreaseRepeatButton>
<RepeatButton Style="{StaticResource SliderRepeatButton}" Command="Slider.IncreaseLarge" />
</Track.IncreaseRepeatButton>
</Track>
</Grid>
</ControlTemplate>
<Style x:Key="Horizontal_Slider" TargetType="Slider">
<Setter Property="Focusable" Value="False"/>
<Setter Property="SnapsToDevicePixels" Value="true"/>
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Width" Value="205"/>
<Setter Property="Height" Value="21"/>
<Setter Property="Foreground" Value="{x:Null}"/>
<Setter Property="FontSize" Value="8"/>
<Setter Property="Margin" Value="5,0,10,0"/>
<Style.Triggers>
<Trigger Property="Orientation" Value="Horizontal">
<Setter Property="MinHeight" Value="21"/>
<Setter Property="MinWidth" Value="104"/>
<Setter Property="Template" Value="{StaticResource Slider}"/>
</Trigger>
</Style.Triggers>
</Style>
<LinearGradientBrush x:Key="ListBoxBackgroundBrush" StartPoint="0,0" EndPoint="1,0.001">
<GradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Color="White" Offset="0.0"/>
<GradientStop Color="White" Offset="0.6"/>
<GradientStop Color="#DDDDDD" Offset="1.2"/>
</GradientStopCollection>
</GradientBrush.GradientStops>
</LinearGradientBrush>
<LinearGradientBrush x:Key="StandardBrush" StartPoint="0,0" EndPoint="0,1">
<GradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Color="#FFF" Offset="0.0"/>
<GradientStop Color="#CCC" Offset="1.0"/>
</GradientStopCollection>
</GradientBrush.GradientStops>
</LinearGradientBrush>
<LinearGradientBrush x:Key="PressedBrush" StartPoint="0,0" EndPoint="0,1">
<GradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Color="#BBB" Offset="0.0"/>
<GradientStop Color="#EEE" Offset="0.1"/>
<GradientStop Color="#EEE" Offset="0.9"/>
<GradientStop Color="#FFF" Offset="1.0"/>
</GradientStopCollection>
</GradientBrush.GradientStops>
</LinearGradientBrush>
<Style x:Key="ScrollBarBackground" TargetType="{x:Type Border}">
<Setter Property="Margin" Value="2"/>
<Setter Property="CornerRadius" Value="6"/>
<Setter Property="Background" Value="{DynamicResource H2}"/>
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="{x:Null}"/>
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="ScrollBarLineButton" TargetType="{x:Type RepeatButton}">
<!--上下按鈕 不顯示-->
<Setter Property="Visibility" Value="Hidden"/>
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="Focusable" Value="false"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RepeatButton}">
<Border Name="Border" Margin="1" CornerRadius="2" Background="{DynamicResource H2}" BorderBrush="{DynamicResource H2}" BorderThickness="1">
<Path HorizontalAlignment="Center" VerticalAlignment="Center" Fill="{DynamicResource H2}" Data="{Binding Path=Content, RelativeSource={RelativeSource TemplatedParent}}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsPressed" Value="true">
<Setter TargetName="Border" Property="Background" Value="{StaticResource PressedBrush}" />
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ScrollBarPageButton" TargetType="{x:Type RepeatButton}">
<Setter Property="Visibility" Value="Visible"/>
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="IsTabStop" Value="false"/>
<Setter Property="Focusable" Value="false"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RepeatButton}">
<Border Background="{x:Null}" Margin="1"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}">
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="IsTabStop" Value="false"/>
<Setter Property="Focusable" Value="false"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Thumb}">
<Border CornerRadius="4" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0" Width="7"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<ControlTemplate x:Key="VerticalScrollBar" TargetType="{x:Type ScrollBar}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition MaxHeight="5"/>
<RowDefinition Height="0.00001*"/>
<RowDefinition MaxHeight="5"/>
</Grid.RowDefinitions>
<!--直向拉竿背景-->
<Border Grid.RowSpan="4" Style="{StaticResource ScrollBarBackground}"/>
<!--往上按鈕 ※隱藏-->
<RepeatButton Grid.Row="0" Style="{StaticResource ScrollBarLineButton}" Height="18" Command="ScrollBar.LineUpCommand" Content="M 0 4 L 8 4 L 4 0 Z" />
<Track Name="PART_Track" Grid.Row="1" IsDirectionReversed="true" IsEnabled="{TemplateBinding IsMouseOver}" >
<Track.DecreaseRepeatButton>
<RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="ScrollBar.PageUpCommand" />
</Track.DecreaseRepeatButton>
<Track.Thumb>
<Thumb Style="{StaticResource ScrollBarThumb}" Margin="1,0,1,0" Background="{DynamicResource H3}" BorderBrush="{DynamicResource H3}" />
</Track.Thumb>
<Track.IncreaseRepeatButton>
<RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="ScrollBar.PageDownCommand" />
</Track.IncreaseRepeatButton>
</Track>
<!--往下按鈕 ※隱藏-->
<RepeatButton Grid.Row="3" Style="{StaticResource ScrollBarLineButton}" Height="18" Command="ScrollBar.LineDownCommand" Content="M 0 0 L 4 4 L 8 0 Z"/>
</Grid>
</ControlTemplate>
<ControlTemplate x:Key="HorizontalScrollBar" TargetType="{x:Type ScrollBar}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition MaxWidth="18"/>
<ColumnDefinition Width="0.00001*"/>
<ColumnDefinition MaxWidth="18"/>
</Grid.ColumnDefinitions>
<!--橫向拉竿背景-->
<Border Grid.ColumnSpan="3" CornerRadius="2" Background="{x:Null}"/>
<RepeatButton Grid.Column="0" Style="{StaticResource ScrollBarLineButton}" Width="18" Command="ScrollBar.LineLeftCommand" Content="M 4 0 L 4 8 L 0 4 Z" />
<Track Name="PART_Track" Grid.Column="1" IsDirectionReversed="False">
<Track.DecreaseRepeatButton>
<RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="ScrollBar.PageLeftCommand" />
</Track.DecreaseRepeatButton>
<Track.Thumb>
<Thumb Style="{StaticResource ScrollBarThumb}" Margin="0,1,0,1" Background="{DynamicResource H3}" BorderBrush="{DynamicResource H3}" />
</Track.Thumb>
<Track.IncreaseRepeatButton>
<RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="ScrollBar.PageRightCommand" />
</Track.IncreaseRepeatButton>
</Track>
<RepeatButton Grid.Column="3" Style="{StaticResource ScrollBarLineButton}" Width="18" Command="ScrollBar.LineRightCommand" Content="M 0 0 L 4 4 L 0 8 Z"/>
</Grid>
</ControlTemplate>
<Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}">
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Style.Triggers>
<Trigger Property="Orientation" Value="Horizontal">
<Setter Property="Width" Value="Auto"/>
<Setter Property="Height" Value="18" />
<Setter Property="Template" Value="{StaticResource HorizontalScrollBar}" />
</Trigger>
<Trigger Property="Orientation" Value="Vertical">
<Setter Property="Width" Value="18"/>
<Setter Property="Height" Value="Auto" />
<Setter Property="Template" Value="{StaticResource VerticalScrollBar}" />
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="FavsScrollViewer" TargetType="{x:Type ScrollViewer}">
<Setter Property="OverridesDefaultStyle" Value="True"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ScrollViewer}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<ScrollContentPresenter Grid.Column="1"/>
<ScrollBar Name="PART_VerticalScrollBar" Value="{TemplateBinding VerticalOffset}" Maximum="{TemplateBinding ScrollableHeight}" ViewportSize="{TemplateBinding ViewportHeight}" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"/>
<ScrollBar Name="PART_HorizontalScrollBar" Orientation="Horizontal" Grid.Row="1" Grid.Column="1" Value="{TemplateBinding HorizontalOffset}" Maximum="{TemplateBinding ScrollableWidth}" ViewportSize="{TemplateBinding ViewportWidth}" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>