theme improvements

This commit is contained in:
2021-04-14 15:28:30 +03:00
parent 4faf7fecc1
commit 55e354b980
12 changed files with 221 additions and 318 deletions

View File

@@ -0,0 +1,26 @@
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Markup;
[assembly: AssemblyDescription("")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None,
ResourceDictionaryLocation.SourceAssembly
)]
[assembly: XmlnsPrefix("http://schemas.brightsharp.com/developer", "bs")]
[assembly: XmlnsDefinition("http://schemas.brightsharp.com/developer", "BrightSharp")]
[assembly: XmlnsDefinition("http://schemas.brightsharp.com/developer", "BrightSharp.Extensions")]
[assembly: XmlnsDefinition("http://schemas.brightsharp.com/developer", "BrightSharp.Behaviors")]
[assembly: XmlnsDefinition("http://schemas.brightsharp.com/developer", "BrightSharp.Converters")]
[assembly: XmlnsPrefix("http://schemas.brightsharp.com/diagrams", "bsDiag")]
[assembly: XmlnsDefinition("http://schemas.brightsharp.com/diagrams", "BrightSharp.Diagrams")]

View File

@@ -1,29 +1,31 @@
using System; using Microsoft.Xaml.Behaviors;
using System;
using System.Collections; using System.Collections;
using System.Linq; using System.Linq;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Data; using System.Windows.Data;
using System.Windows.Interactivity;
using System.Windows.Threading; using System.Windows.Threading;
namespace BrightSharp.Behaviors namespace BrightSharp.Behaviors
{ {
public class FilterDefaultViewTextBoxBehavior : Behavior<TextBox> public class FilterDefaultViewTextBoxBehavior : Behavior<TextBox>
{ {
DispatcherTimer timer = new DispatcherTimer(); readonly DispatcherTimer _timer = new DispatcherTimer();
public FilterDefaultViewTextBoxBehavior() public FilterDefaultViewTextBoxBehavior()
{ {
timer.Tick += Timer_Tick; _timer.Tick += Timer_Tick;
FilterDelay = TimeSpan.FromSeconds(1); FilterDelay = TimeSpan.FromSeconds(1);
IgnoreCase = null; //Case sensitive if any char upper case IgnoreCase = null; //Case sensitive if any char upper case
FilterStringPropertyName = "FilterString"; FilterStringPropertyName = "FilterString";
} }
private void Timer_Tick(object sender, EventArgs e) private void Timer_Tick(object sender, EventArgs e)
{ {
timer.Stop(); _timer.Stop();
if (ItemsSource != null) if (ItemsSource != null)
{ {
var view = CollectionViewSource.GetDefaultView(ItemsSource); var view = CollectionViewSource.GetDefaultView(ItemsSource);
@@ -90,7 +92,7 @@ namespace BrightSharp.Behaviors
public Predicate<object> CustomFilter { get; set; } public Predicate<object> CustomFilter { get; set; }
public TimeSpan FilterDelay { get { return timer.Interval; } set { timer.Interval = value; } } public TimeSpan FilterDelay { get { return _timer.Interval; } set { _timer.Interval = value; } }
protected override void OnAttached() protected override void OnAttached()
{ {
@@ -101,14 +103,14 @@ namespace BrightSharp.Behaviors
private void AssociatedObject_TextChanged(object sender, TextChangedEventArgs e) private void AssociatedObject_TextChanged(object sender, TextChangedEventArgs e)
{ {
timer.Stop(); timer.Start(); _timer.Stop(); _timer.Start();
HasFilterText = !string.IsNullOrEmpty(AssociatedObject.Text); HasFilterText = !string.IsNullOrEmpty(AssociatedObject.Text);
} }
protected override void OnDetaching() protected override void OnDetaching()
{ {
AssociatedObject.TextChanged -= AssociatedObject_TextChanged; AssociatedObject.TextChanged -= AssociatedObject_TextChanged;
timer.Tick -= Timer_Tick; _timer.Tick -= Timer_Tick;
base.OnDetaching(); base.OnDetaching();
} }
} }

View File

@@ -2,6 +2,7 @@
using BrightSharp.Interop.Constants; using BrightSharp.Interop.Constants;
using BrightSharp.Interop.Structures; using BrightSharp.Interop.Structures;
using System; using System;
using System.Diagnostics;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Windows; using System.Windows;
using System.Windows.Interop; using System.Windows.Interop;
@@ -38,6 +39,7 @@ namespace BrightSharp.Behaviors
} }
} }
[DebuggerStepThrough]
private IntPtr WindowProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) private IntPtr WindowProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
{ {
switch (msg) switch (msg)

View File

@@ -1,6 +1,6 @@
using System.Windows.Controls.Primitives; using Microsoft.Xaml.Behaviors;
using System.Windows.Controls.Primitives;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Interactivity;
namespace BrightSharp.Behaviors namespace BrightSharp.Behaviors
{ {

View File

@@ -1,23 +1,22 @@
using System.Windows; using Microsoft.Xaml.Behaviors;
using System.Windows.Interactivity; using System.Windows;
using System.Windows.Interop;
namespace BrightSharp.Behaviors namespace BrightSharp.Behaviors
{ {
public class WindowMinMaxSizeBehavior : Behavior<Window> public class WindowMinMaxSizeBehavior : Behavior<Window>
{ {
private MinMaxSize_Logic logic; private MinMaxSize_Logic _logic;
protected override void OnAttached() protected override void OnAttached()
{ {
base.OnAttached(); base.OnAttached();
logic = new MinMaxSize_Logic(AssociatedObject); _logic = new MinMaxSize_Logic(AssociatedObject);
logic.OnAttached(); _logic.OnAttached();
} }
protected override void OnDetaching() protected override void OnDetaching()
{ {
logic.OnDetaching(); _logic.OnDetaching();
base.OnDetaching(); base.OnDetaching();
} }
} }

View File

@@ -1,218 +1,74 @@
<?xml version="1.0" encoding="utf-8"?> <Project Sdk="Microsoft.NET.Sdk">
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <TargetFramework>net5.0-windows</TargetFramework>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <UseWPF>true</UseWPF>
<ProjectGuid>{ACC3C556-F8E4-4F2A-A23D-8E8749679A1B}</ProjectGuid> <Platforms>AnyCPU;x64</Platforms>
<OutputType>library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BrightSharp</RootNamespace>
<AssemblyName>BrightSharp</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <None Remove="Themes\icons\app.png" />
<Reference Include="System.Data" /> <None Remove="Themes\icons\copy.png" />
<Reference Include="System.Windows.Interactivity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <None Remove="Themes\icons\cut.png" />
<HintPath>G:\repositories\Tps.Next\packages\System.Windows.Interactivity.WPF.2.0.20525\lib\net40\System.Windows.Interactivity.dll</HintPath> <None Remove="Themes\icons\paste.png" />
</Reference> <None Remove="Themes\icons\undo.png" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Behaviors\FilterDefaultViewTextBoxBehavior.cs" /> <PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.31" />
<Compile Include="Behaviors\SelectAllTextOnFocusBehavior.cs" />
<Compile Include="Behaviors\MinMaxSize_Logic.cs" />
<Compile Include="Behaviors\WindowMinMaxSizeBehavior.cs" />
<Compile Include="Commands\AsyncCommand.cs" />
<Compile Include="Commands\RelayCommand.cs" />
<Compile Include="Converters\IntToValueConverter.cs" />
<Compile Include="Converters\InverseBooleanToVisibilityConverter.cs" />
<Compile Include="Diagrams\Adorners\ResizeRotateAdorner.cs" />
<Compile Include="Diagrams\Adorners\ResizeRotateChrome.cs" />
<Compile Include="Diagrams\Adorners\SizeAdorner.cs" />
<Compile Include="Diagrams\Adorners\SizeChrome.cs" />
<Compile Include="Diagrams\DesignerItemDecorator.cs" />
<Compile Include="Diagrams\VisualExtensions.cs" />
<Compile Include="Diagrams\SelectionBehavior.cs" />
<Compile Include="Diagrams\Thumbs\MoveThumb.cs" />
<Compile Include="Diagrams\Thumbs\ResizeThumb.cs" />
<Compile Include="Diagrams\Thumbs\RotateThumb.cs" />
<Compile Include="Extensions\WpfExtensions.cs" />
<Compile Include="Interop\Constants.cs" />
<Compile Include="Interop\NativeMethods.cs" />
<Compile Include="Interop\Structures.cs" />
<Compile Include="Themes\Theme.cs">
<DependentUpon>Theme.xaml</DependentUpon>
</Compile>
<Compile Include="Themes\ThemeManager.cs" />
<Compile Include="Diagrams\ZoomControl.cs">
<SubType>Code</SubType>
</Compile>
<Page Include="Themes\Controls\ZoomControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Themes\Generic.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Compile Include="Converters\ThicknessConverter.cs" />
<Compile Include="Extensions\MarkupExtensionProperties.cs" />
<None Include="packages.config" />
<None Include="Themes\Theme.Static.cs">
<DependentUpon>Theme.Static.xaml</DependentUpon>
</None>
<Page Include="Themes\Diagrams\DesignerItem.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Themes\Diagrams\ResizeRotateChrome.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Themes\Diagrams\SizeChrome.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Themes\Style.Blue.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Themes\Style.Classic.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Themes\Style.DarkBlue.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Themes\Style.Silver.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Themes\Style.DevLab.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Themes\Theme.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<None Include="Themes\Theme.Static.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</None>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AppDesigner Include="Properties\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Resource Include="Themes\icons\app.png" /> <Resource Include="Themes\icons\app.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Themes\icons\copy.png" /> <Resource Include="Themes\icons\copy.png" />
<Resource Include="Themes\icons\cut.png" /> <Resource Include="Themes\icons\cut.png" />
<Resource Include="Themes\icons\paste.png" /> <Resource Include="Themes\icons\paste.png" />
<Resource Include="Themes\icons\undo.png" /> <Resource Include="Themes\icons\undo.png" />
</ItemGroup> </ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ItemGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <Compile Update="Diagrams\ZoomControl.cs">
Other similar extension points exist, see Microsoft.Common.targets. <SubType>Code</SubType>
<Target Name="BeforeBuild"> </Compile>
</Target> <Compile Update="Themes\Theme.cs">
<Target Name="AfterBuild"> <DependentUpon>Theme.xaml</DependentUpon>
</Target> </Compile>
--> </ItemGroup>
<ItemGroup>
<Page Update="Themes\Controls\ZoomControl.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Themes\Diagrams\DesignerItem.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Themes\Diagrams\ResizeRotateChrome.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Themes\Diagrams\SizeChrome.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Themes\Generic.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Themes\Style.Blue.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Themes\Style.Classic.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Themes\Style.DarkBlue.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Themes\Style.DevLab.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Themes\Style.Silver.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Themes\Theme.xaml">
<SubType>Designer</SubType>
</Page>
</ItemGroup>
</Project> </Project>

View File

@@ -21,6 +21,11 @@ namespace BrightSharp.Commands
_canExecuteEvaluator = canExecuteEvaluator; _canExecuteEvaluator = canExecuteEvaluator;
} }
public RelayCommand(Action methodToExecute)
{
_methodToExecute = methodToExecute;
}
public bool CanExecute(object parameter) public bool CanExecute(object parameter)
{ {
if (_canExecuteEvaluator == null) if (_canExecuteEvaluator == null)
@@ -35,7 +40,7 @@ namespace BrightSharp.Commands
} }
} }
public class RelayCommand<T> : ICommand public class RelayCommand<T> : ICommand where T : class
{ {
private readonly Action<T> _methodToExecuteWithParam; private readonly Action<T> _methodToExecuteWithParam;
private readonly Func<T, bool> _canExecuteEvaluator; private readonly Func<T, bool> _canExecuteEvaluator;
@@ -56,11 +61,11 @@ namespace BrightSharp.Commands
{ {
if (_canExecuteEvaluator == null) if (_canExecuteEvaluator == null)
return true; return true;
return _canExecuteEvaluator.Invoke((T)parameter); return _canExecuteEvaluator.Invoke(parameter as T);
} }
public void Execute(object parameter) public void Execute(object parameter)
{ {
_methodToExecuteWithParam?.Invoke((T)parameter); _methodToExecuteWithParam?.Invoke(parameter as T);
} }
} }
} }

View File

@@ -212,11 +212,10 @@
<LinearGradientBrush x:Key="WindowBackgroundBrush"> <LinearGradientBrush x:Key="WindowBackgroundBrush">
<GradientStop Color="#EEE" /> <GradientStop Color="#EEE" />
</LinearGradientBrush> </LinearGradientBrush>
<SolidColorBrush x:Key="SelectedBackgroundBrush" Color="#FFDFE1E8" /> <SolidColorBrush x:Key="SelectedBackgroundBrush" Color="#FAE0A0" />
<SolidColorBrush x:Key="GlyphBrush" Color="#444" /> <SolidColorBrush x:Key="GlyphBrush" Color="#444" />
<SolidColorBrush x:Key="LightColorBrush" Color="#DDD" /> <SolidColorBrush x:Key="LightColorBrush" Color="#DDD" />
<Color x:Key="OnWindowForegroundColor">Black</Color> <Color x:Key="OnWindowForegroundColor">Black</Color>
<SolidColorBrush x:Key="OnWindowForegroundBrush" Color="{DynamicResource OnWindowForegroundColor}" />
<SolidColorBrush x:Key="DisabledForegroundBrush" Color="#FF4D4D4D" /> <SolidColorBrush x:Key="DisabledForegroundBrush" Color="#FF4D4D4D" />
<SolidColorBrush x:Key="DisabledBackgroundBrush" Color="#EEE" /> <SolidColorBrush x:Key="DisabledBackgroundBrush" Color="#EEE" />
<LinearGradientBrush x:Key="LightBrush" StartPoint="0,0" EndPoint="0,1"> <LinearGradientBrush x:Key="LightBrush" StartPoint="0,0" EndPoint="0,1">
@@ -229,10 +228,9 @@
</LinearGradientBrush> </LinearGradientBrush>
<SolidColorBrush x:Key="ScrollBarBackgroundBrush" Color="#F0F0F0" /> <SolidColorBrush x:Key="ScrollBarBackgroundBrush" Color="#F0F0F0" />
<SolidColorBrush x:Key="HighLightForegroundBrush" Color="#FF2E2020" /> <SolidColorBrush x:Key="HighLightForegroundBrush" Color="#FF2E2020" />
<Color x:Key="SelectedUnfocusedColor">#E0E0EA</Color>
<Color x:Key="UiForegroundColor">Black</Color> <Color x:Key="UiForegroundColor">Black</Color>
<SolidColorBrush x:Key="UiForegroundBrush" Color="{DynamicResource UiForegroundColor}" /> <Color x:Key="SelectedBackgroundColor">#FAE0A0</Color>
<Color x:Key="SelectedBackgroundColor">#DEE4FF</Color>
<Color x:Key="SelectedUnfocusedColor">#FFB6B6B6</Color>
<Color x:Key="ControlLightColor">#FFFFFFFF</Color> <Color x:Key="ControlLightColor">#FFFFFFFF</Color>
<Color x:Key="ControlMediumColor">#FFC5C5C5</Color> <Color x:Key="ControlMediumColor">#FFC5C5C5</Color>
<Color x:Key="ControlDarkColor">#FF6B6B6B</Color> <Color x:Key="ControlDarkColor">#FF6B6B6B</Color>
@@ -240,6 +238,9 @@
<Color x:Key="ControlPressedColor">#FF47909B</Color> <Color x:Key="ControlPressedColor">#FF47909B</Color>
<Color x:Key="BorderLightColor">#D6D6D6</Color> <Color x:Key="BorderLightColor">#D6D6D6</Color>
<Color x:Key="BorderMediumColor">#E6E6E6</Color> <Color x:Key="BorderMediumColor">#E6E6E6</Color>
<SolidColorBrush x:Key="OnWindowForegroundBrush" Color="Black" />
<SolidColorBrush x:Key="SelectedUnfocusedBrush" Color="#FFB0B0EA" />
<SolidColorBrush x:Key="UiForegroundBrush" Color="Black" />
<!--Window Brushes--> <!--Window Brushes-->
@@ -247,15 +248,16 @@
<SolidColorBrush x:Key="WindowHeaderInactiveBackgroundBrush" Color="#8888" /> <SolidColorBrush x:Key="WindowHeaderInactiveBackgroundBrush" Color="#8888" />
<LinearGradientBrush x:Key="GradientWindowBackgroundBrush" EndPoint="1,1" StartPoint="0,0"> <LinearGradientBrush x:Key="GradientWindowBackgroundBrush" EndPoint="1,1" StartPoint="0,0">
<GradientStop Color="#FFAFBAD6" Offset="0"/>
<GradientStop Color="White" Offset="1"/> <GradientStop Color="White" Offset="1"/>
<GradientStop Color="#FFD1E3FF" Offset="0.766"/> <GradientStop Color="#FFE9F2FF" Offset="0.766"/>
<GradientStop Color="#FFE2E8F8" Offset="0.238"/> <GradientStop Color="#FFE2E8F8" Offset="0.238"/>
<GradientStop Color="#FFD0D8EC" Offset="0"/>
</LinearGradientBrush> </LinearGradientBrush>
<LinearGradientBrush x:Key="WindowHeaderBrush" EndPoint="0,1"> <LinearGradientBrush x:Key="WindowHeaderBrush" EndPoint="0,1">
<GradientStop Color="#FFEEEEEE" /> <GradientStop Color="#F4F4FF" />
<GradientStop Color="#FFCCCCCC" Offset="1" /> <GradientStop Color="#FFD4EAFF" Offset="1" />
</LinearGradientBrush> </LinearGradientBrush>
<LinearGradientBrush x:Key="WindowHeaderInactiveBrush" EndPoint="0,1"> <LinearGradientBrush x:Key="WindowHeaderInactiveBrush" EndPoint="0,1">

View File

@@ -224,7 +224,7 @@
<Color x:Key="SelectedBackgroundColor">#E3E3E3</Color> <Color x:Key="SelectedBackgroundColor">#E3E3E3</Color>
<Color x:Key="SelectedUnfocusedColor">#FFB6B6B6</Color> <Color x:Key="SelectedUnfocusedColor">#FFD6E6E6</Color>
<Color x:Key="ControlLightColor">#FFFFFFFF</Color> <Color x:Key="ControlLightColor">#FFFFFFFF</Color>
<Color x:Key="ControlMediumColor">#FFC5C5C5</Color> <Color x:Key="ControlMediumColor">#FFC5C5C5</Color>
<Color x:Key="ControlDarkColor">#FF6B6B6B</Color> <Color x:Key="ControlDarkColor">#FF6B6B6B</Color>

View File

@@ -36,7 +36,5 @@ namespace BrightSharp.Themes
var window = Window.GetWindow((DependencyObject)sender); var window = Window.GetWindow((DependencyObject)sender);
window.WindowState = WindowState.Minimized; window.WindowState = WindowState.Minimized;
} }
} }
} }

View File

@@ -17,10 +17,10 @@
<BorderGapMaskConverter x:Key="BorderGapMaskConverter" /> <BorderGapMaskConverter x:Key="BorderGapMaskConverter" />
<BooleanToVisibilityConverter x:Key="btvc" /> <BooleanToVisibilityConverter x:Key="btvc" />
<conv:InverseBooleanToVisibilityConverter x:Key="ibtvc" /> <conv:InverseBooleanToVisibilityConverter x:Key="ibtvc" />
<conv:IntToValueConverter x:Key="btvhc" FalseValue="Hidden" TrueValue="Visible" />
<!--STYLES--> <!--STYLES-->
<ContextMenu x:Key="DecoTextBoxContextMenu"> <ContextMenu x:Key="DecoTextBoxContextMenu">
<MenuItem Command="ApplicationCommands.Copy"> <MenuItem Command="ApplicationCommands.Copy">
<MenuItem.Icon> <MenuItem.Icon>
@@ -2440,7 +2440,7 @@
</Setter.Value> </Setter.Value>
</Setter> </Setter>
</Style> </Style>
<Style TargetType="{x:Type GroupBox}"> <Style x:Key="GroupBoxSimpleBorderStyle" TargetType="{x:Type GroupBox}">
<Setter Property="OverridesDefaultStyle" Value="True" /> <Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="BorderBrush" Value="{DynamicResource UiForegroundBrush}"/> <Setter Property="BorderBrush" Value="{DynamicResource UiForegroundBrush}"/>
<Setter Property="BorderThickness" Value="1"/> <Setter Property="BorderThickness" Value="1"/>
@@ -2485,7 +2485,7 @@
</Setter.Value> </Setter.Value>
</Setter> </Setter>
</Style> </Style>
<Style x:Key="ExpandrStyleGroupBox" TargetType="{x:Type GroupBox}"> <Style TargetType="{x:Type GroupBox}">
<Setter Property="OverridesDefaultStyle" Value="True" /> <Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="Background" Value="{DynamicResource WindowBackgroundBrush}" /> <Setter Property="Background" Value="{DynamicResource WindowBackgroundBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource NormalBorderBrush}" /> <Setter Property="BorderBrush" Value="{DynamicResource NormalBorderBrush}" />
@@ -2565,28 +2565,6 @@
</Setter.Value> </Setter.Value>
</Setter> </Setter>
</Style> </Style>
<Style x:Key="{x:Type Label}" TargetType="{x:Type Label}">
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<Setter Property="Padding" Value="2"/>
<Setter Property="Foreground" Value="{DynamicResource OnWindowForegroundBrush}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Label}">
<Border Padding="{TemplateBinding Padding}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
<ContentPresenter
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
RecognizesAccessKey="True"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="{DynamicResource DisabledForegroundBrush}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="{x:Type ListBox}" TargetType="{x:Type ListBox}"> <Style x:Key="{x:Type ListBox}" TargetType="{x:Type ListBox}">
<Setter Property="SnapsToDevicePixels" Value="true"/> <Setter Property="SnapsToDevicePixels" Value="true"/>
<Setter Property="OverridesDefaultStyle" Value="true"/> <Setter Property="OverridesDefaultStyle" Value="true"/>
@@ -2674,6 +2652,9 @@
<Trigger Property="IsEnabled" Value="false"> <Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="{DynamicResource DisabledForegroundBrush}"/> <Setter Property="Foreground" Value="{DynamicResource DisabledForegroundBrush}"/>
</Trigger> </Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource SelectedUnfocusedBrush}" />
</Trigger>
</ControlTemplate.Triggers> </ControlTemplate.Triggers>
</ControlTemplate> </ControlTemplate>
</Setter.Value> </Setter.Value>
@@ -2957,7 +2938,7 @@
</Setter.Value> </Setter.Value>
</Setter> </Setter>
</Style> </Style>
<Style TargetType="{x:Type ContextMenu}"> <Style x:Key="{x:Type ContextMenu}" TargetType="{x:Type ContextMenu}">
<Setter Property="SnapsToDevicePixels" Value="True"/> <Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="OverridesDefaultStyle" Value="True"/> <Setter Property="OverridesDefaultStyle" Value="True"/>
<Setter Property="Grid.IsSharedSizeScope" Value="true"/> <Setter Property="Grid.IsSharedSizeScope" Value="true"/>
@@ -3016,14 +2997,13 @@
<DoubleAnimation Duration="0:0:0.2" Storyboard.TargetName="MenuBackground" Storyboard.TargetProperty="Opacity" /> <DoubleAnimation Duration="0:0:0.2" Storyboard.TargetName="MenuBackground" Storyboard.TargetProperty="Opacity" />
</Storyboard> </Storyboard>
</ControlTemplate.Resources> </ControlTemplate.Resources>
<Border x:Name="Border"> <Border x:Name="Border" Background="{TemplateBinding Background}">
<Grid> <Grid>
<Border x:Name="MenuBackground" IsHitTestVisible="False" Background="{DynamicResource TopLevelMenuBackgroundHover}" Opacity="0" /> <Border x:Name="MenuBackground" IsHitTestVisible="False" Background="{DynamicResource TopLevelMenuBackgroundHover}" Opacity="0" />
<Popup <Popup
x:Name="Popup" x:Name="Popup"
Placement="Relative" Placement="Relative"
VerticalOffset="{Binding ElementName=Border, Path=ActualHeight}" VerticalOffset="{Binding ElementName=Border, Path=ActualHeight}"
HorizontalOffset="{Binding ElementName=SubmenuBorder, Path=ActualWidth}"
IsOpen="{TemplateBinding IsSubmenuOpen}" IsOpen="{TemplateBinding IsSubmenuOpen}"
AllowsTransparency="True" AllowsTransparency="True"
Focusable="False" Focusable="False"
@@ -3076,7 +3056,7 @@
<ControlTemplate <ControlTemplate
x:Key="{x:Static MenuItem.TopLevelItemTemplateKey}" x:Key="{x:Static MenuItem.TopLevelItemTemplateKey}"
TargetType="{x:Type MenuItem}"> TargetType="{x:Type MenuItem}">
<Border x:Name="Border" > <Border x:Name="Border" Background="{TemplateBinding Background}">
<Grid> <Grid>
<ContentPresenter <ContentPresenter
Margin="6,3,6,3" Margin="6,3,6,3"
@@ -3315,9 +3295,9 @@
</MultiTrigger> </MultiTrigger>
</ControlTemplate.Triggers> </ControlTemplate.Triggers>
</ControlTemplate> </ControlTemplate>
<Style x:Key="{x:Type MenuItem}" TargetType="{x:Type MenuItem}"> <Style TargetType="{x:Type MenuItem}">
<Setter Property="OverridesDefaultStyle" Value="True"/> <Setter Property="OverridesDefaultStyle" Value="True"/>
<Setter Property="Background" Value="Transparent" /> <Setter Property="Background" Value="{DynamicResource WindowBackgroundBrush}" />
<Style.Triggers> <Style.Triggers>
<Trigger Property="Role" Value="TopLevelHeader"> <Trigger Property="Role" Value="TopLevelHeader">
<Setter Property="BorderThickness" Value="1"/> <Setter Property="BorderThickness" Value="1"/>
@@ -3431,7 +3411,7 @@
</Trigger> </Trigger>
<Trigger Property="Validation.HasError" Value="true"> <Trigger Property="Validation.HasError" Value="true">
<Setter Property="BorderBrush" Value="Red" /> <Setter Property="BorderBrush" Value="Red" />
<Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self},Path=(Validation.Errors)[0].ErrorContent}"/> <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, FallbackValue={x:Null}, Path=(Validation.Errors)[0].ErrorContent}"/>
</Trigger> </Trigger>
</ControlTemplate.Triggers> </ControlTemplate.Triggers>
</ControlTemplate> </ControlTemplate>
@@ -4711,10 +4691,6 @@
</Setter> </Setter>
</Style> </Style>
<Style BasedOn="{StaticResource RoundedTabItemStyle}" TargetType="{x:Type TabItem}"></Style> <Style BasedOn="{StaticResource RoundedTabItemStyle}" TargetType="{x:Type TabItem}"></Style>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="TextWrapping" Value="NoWrap"/>
<Setter Property="TextTrimming" Value="None"/>
</Style>
<Style x:Key="{x:Type TextBox}" TargetType="{x:Type TextBox}"> <Style x:Key="{x:Type TextBox}" TargetType="{x:Type TextBox}">
<Setter Property="SnapsToDevicePixels" Value="True" /> <Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="BorderThickness" Value="1" /> <Setter Property="BorderThickness" Value="1" />
@@ -4757,7 +4733,7 @@
</BeginStoryboard> </BeginStoryboard>
</EventTrigger> </EventTrigger>
</Label.Triggers> </Label.Triggers>
<TextBlock TextWrapping="Wrap" Text="{Binding ElementName=MyAdorner, Path=AdornedElement.(Validation.Errors)[0].ErrorContent}"></TextBlock> <TextBlock TextWrapping="Wrap" Text="{Binding ElementName=MyAdorner, FallbackValue={x:Null}, Path=AdornedElement.(Validation.Errors)[0].ErrorContent}"></TextBlock>
</Label> </Label>
</Grid> </Grid>
</ControlTemplate> </ControlTemplate>
@@ -4814,8 +4790,8 @@
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<ContentControl Margin="2,0,0,0" Content="{TemplateBinding bs:MarkupExtensionProperties.LeadingElement}" VerticalAlignment="Center" /> <ContentControl Margin="2,0,0,0" Content="{TemplateBinding bs:MarkupExtensionProperties.LeadingElement}" VerticalAlignment="Center" />
<ContentControl Margin="0,0,2,0" Grid.Column="2" Content="{TemplateBinding bs:MarkupExtensionProperties.TrailingElement}" VerticalAlignment="Center" /> <ContentControl Margin="0,0,2,0" Grid.Column="2" Content="{TemplateBinding bs:MarkupExtensionProperties.TrailingElement}" VerticalAlignment="Center" />
<Border Visibility="{Binding (Validation.HasError), RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource btvc}}" Grid.Column="3" VerticalAlignment="Center" Width="15" Height="14" HorizontalAlignment="Right" BorderBrush="White" BorderThickness="1" CornerRadius="7" Margin="0,0,4,0" <Border x:Name="ErrorInfoBorder" Grid.Column="3" Visibility="Collapsed" VerticalAlignment="Center" Width="15" Height="14" HorizontalAlignment="Right" BorderBrush="White" BorderThickness="1" CornerRadius="7" Margin="0,0,4,0"
Opacity=".8" ToolTip="{Binding Path=(Validation.Errors)[0].ErrorContent, RelativeSource={RelativeSource TemplatedParent}}"> Opacity=".8">
<Border.Background> <Border.Background>
<SolidColorBrush Color="{DynamicResource ValidationErrorColor}" /> <SolidColorBrush Color="{DynamicResource ValidationErrorColor}" />
</Border.Background> </Border.Background>
@@ -4875,7 +4851,8 @@
<SolidColorBrush Color="{DynamicResource ValidationErrorColor}" /> <SolidColorBrush Color="{DynamicResource ValidationErrorColor}" />
</Setter.Value> </Setter.Value>
</Setter> </Setter>
<!--<Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self},Path=(Validation.Errors)[0].ErrorContent}"/>--> <Setter TargetName="ErrorInfoBorder" Property="Visibility" Value="Visible"/>
<Setter TargetName="ErrorInfoBorder" Property="ToolTip" Value="{Binding Path=(Validation.Errors)[0].ErrorContent, FallbackValue={x:Null}, RelativeSource={RelativeSource TemplatedParent}}"/>
</Trigger> </Trigger>
</ControlTemplate.Triggers> </ControlTemplate.Triggers>
</ControlTemplate> </ControlTemplate>
@@ -5478,7 +5455,7 @@
</Setter.Value> </Setter.Value>
</Setter> </Setter>
</Style> </Style>
<Style x:Key="{x:Type TreeView}" TargetType="{x:Type TreeView}"> <Style TargetType="{x:Type TreeView}">
<Setter Property="OverridesDefaultStyle" Value="True" /> <Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="SnapsToDevicePixels" Value="True" /> <Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="UseLayoutRounding" Value="True" /> <Setter Property="UseLayoutRounding" Value="True" />
@@ -5490,28 +5467,39 @@
<Setter Property="Padding" Value="2" /> <Setter Property="Padding" Value="2" />
<Setter Property="BorderBrush" Value="{DynamicResource SolidBorderBrush}"/> <Setter Property="BorderBrush" Value="{DynamicResource SolidBorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/> <Setter Property="BorderThickness" Value="1"/>
<!--<EventSetter Event="Drop" Handler="treeView_Drop"/>--> <Setter Property="ScrollViewer.PanningMode" Value="Both"/>
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="{x:Type TreeView}"> <ControlTemplate TargetType="{x:Type TreeView}">
<Border <Border x:Name="Bd" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" SnapsToDevicePixels="true">
x:Name="Border" <ScrollViewer x:Name="_tv_scrollviewer_" Background="{TemplateBinding Background}" CanContentScroll="false" Focusable="false" HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}">
CornerRadius="{TemplateBinding bs:MarkupExtensionProperties.CornerRadius}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<ScrollViewer x:Name="ScrollViewer" Padding="{TemplateBinding Padding}" Focusable="False">
<ItemsPresenter/> <ItemsPresenter/>
</ScrollViewer> </ScrollViewer>
</Border> </Border>
<ControlTemplate.Triggers> <ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false"> <Trigger Property="IsEnabled" Value="false">
<Setter TargetName="ScrollViewer" Property="Opacity" Value="0.7" /> <Setter Property="Background" TargetName="Bd" Value="{DynamicResource SolidBorderBrush}"/>
</Trigger>
<Trigger Property="VirtualizingPanel.IsVirtualizing" Value="true">
<Setter Property="CanContentScroll" TargetName="_tv_scrollviewer_" Value="true"/>
</Trigger> </Trigger>
</ControlTemplate.Triggers> </ControlTemplate.Triggers>
</ControlTemplate> </ControlTemplate>
</Setter.Value> </Setter.Value>
</Setter> </Setter>
<Style.Triggers>
<Trigger Property="VirtualizingPanel.IsVirtualizing" Value="true">
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<VirtualizingStackPanel/>
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style> </Style>
<Style x:Key="ExpandCollapseToggleStyle" TargetType="{x:Type ToggleButton}"> <Style x:Key="ExpandCollapseToggleStyle" TargetType="{x:Type ToggleButton}">
<Setter Property="Focusable" Value="False"/> <Setter Property="Focusable" Value="False"/>
@@ -5583,6 +5571,9 @@
<Setter Property="FocusVisualStyle" Value="{x:Null}" /> <Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="Padding" Value="0,3,0,3" /> <Setter Property="Padding" Value="0,3,0,3" />
<Setter Property="Background" Value="Transparent" /> <Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="Black" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="BorderBrush" Value="{DynamicResource SolidBorderBrush}" />
<Setter Property="bs:MarkupExtensionProperties.SpecialWidth" Value="16" /> <Setter Property="bs:MarkupExtensionProperties.SpecialWidth" Value="16" />
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
@@ -5597,7 +5588,7 @@
<ColumnDefinition /> <ColumnDefinition />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Rectangle x:Name="OffsetRect" Width="{TemplateBinding bs:MarkupExtensionProperties.SpecialWidth}" /> <Rectangle x:Name="OffsetRect" Width="{TemplateBinding bs:MarkupExtensionProperties.SpecialWidth}" />
<Border x:Name="Border" Background="{TemplateBinding Background}" Grid.ColumnSpan="2" /> <Border x:Name="Border" Margin="13,0,0,0" Background="{TemplateBinding Background}" Grid.ColumnSpan="2" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" />
<Rectangle Name="FocusRect" Grid.Column="1" Stroke="#60000000" StrokeDashArray="1 2" Visibility="Hidden" Grid.ColumnSpan="2"/> <Rectangle Name="FocusRect" Grid.Column="1" Stroke="#60000000" StrokeDashArray="1 2" Visibility="Hidden" Grid.ColumnSpan="2"/>
<ToggleButton Grid.ColumnSpan="2" <ToggleButton Grid.ColumnSpan="2"
x:Name="Expander" x:Name="Expander"
@@ -5607,7 +5598,7 @@
<Grid Background="Transparent" x:Name="PART_Header" Grid.ColumnSpan="2" Margin="16,0,0,0"> <Grid Background="Transparent" x:Name="PART_Header" Grid.ColumnSpan="2" Margin="16,0,0,0">
<ContentPresenter ContentSource="Header" Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" /> <ContentPresenter ContentSource="Header" Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
</Grid> </Grid>
<ItemsPresenter Grid.Column="1" Grid.Row="1" x:Name="ItemsHost" /> <VirtualizingStackPanel Grid.Column="1" Grid.Row="1" x:Name="ItemsHost" IsItemsHost="true" />
</Grid> </Grid>
<ControlTemplate.Triggers> <ControlTemplate.Triggers>
<Trigger Property="IsExpanded" Value="false"> <Trigger Property="IsExpanded" Value="false">
@@ -5616,10 +5607,11 @@
<Trigger Property="HasItems" Value="false"> <Trigger Property="HasItems" Value="false">
<Setter TargetName="Expander" Property="Visibility" Value="Hidden"/> <Setter TargetName="Expander" Property="Visibility" Value="Hidden"/>
<Setter TargetName="OffsetRect" Property="Width" Value="8" /> <Setter TargetName="OffsetRect" Property="Width" Value="8" />
<Setter TargetName="PART_Header" Property="Margin" Value="3,0,0,0" /> <!--<Setter TargetName="PART_Header" Property="Margin" Value="3,0,0,0" />-->
</Trigger> </Trigger>
<Trigger Property="IsSelected" Value="true"> <Trigger Property="IsSelected" Value="true">
<Setter TargetName="Border" Property="Background" Value="{DynamicResource SelectedBackgroundBrush}"/> <Setter TargetName="Border" Property="Background" Value="{DynamicResource SelectedBackgroundBrush}"/>
<Setter TargetName="Border" Property="BorderThickness" Value="1"/>
<Setter Property="TextBlock.Foreground" Value="{DynamicResource HighLightForegroundBrush}" /> <Setter Property="TextBlock.Foreground" Value="{DynamicResource HighLightForegroundBrush}" />
</Trigger> </Trigger>
<Trigger Property="IsSelected" Value="False"> <Trigger Property="IsSelected" Value="False">
@@ -5651,11 +5643,10 @@
<Setter Property="BorderBrush" Value="{DynamicResource WindowBorderBrush}" /> <Setter Property="BorderBrush" Value="{DynamicResource WindowBorderBrush}" />
<Setter Property="bs:MarkupExtensionProperties.UseMinMaxSizeBehavior" Value="True" /> <Setter Property="bs:MarkupExtensionProperties.UseMinMaxSizeBehavior" Value="True" />
<Setter Property="BorderThickness" Value="1" /> <Setter Property="BorderThickness" Value="1" />
<Setter Property="Icon" Value="icons/app.png" />
<Setter Property="UseLayoutRounding" Value="True" /> <Setter Property="UseLayoutRounding" Value="True" />
<Setter Property="WindowChrome.WindowChrome"> <Setter Property="WindowChrome.WindowChrome">
<Setter.Value> <Setter.Value>
<WindowChrome CaptionHeight="30" ResizeBorderThickness="4" CornerRadius="0" GlassFrameThickness="0" UseAeroCaptionButtons="False" /> <WindowChrome CaptionHeight="30" ResizeBorderThickness="4" CornerRadius="0" GlassFrameThickness="1" UseAeroCaptionButtons="False" />
</Setter.Value> </Setter.Value>
</Setter> </Setter>
<Setter Property="Foreground" Value="{DynamicResource OnWindowForegroundBrush}"/> <Setter Property="Foreground" Value="{DynamicResource OnWindowForegroundBrush}"/>
@@ -5683,9 +5674,31 @@
<GradientStop Color="WhiteSmoke" Offset="0.0"/> <GradientStop Color="WhiteSmoke" Offset="0.0"/>
</LinearGradientBrush> </LinearGradientBrush>
</StackPanel.Resources> </StackPanel.Resources>
<Button Padding="10,6" VerticalAlignment="Top" Name="PART_MinimizeButton" Click="minimizeButton_Click" Focusable="False" WindowChrome.IsHitTestVisibleInChrome="True" Content="0" bs:MarkupExtensionProperties.CornerRadius="0" BorderBrush="Transparent" FontFamily="Webdings" /> <Button Padding="10,6" VerticalAlignment="Top" Name="PART_MinimizeButton" Click="minimizeButton_Click" Focusable="False" WindowChrome.IsHitTestVisibleInChrome="True" Content="0" bs:MarkupExtensionProperties.CornerRadius="0" BorderThickness="0" FontFamily="Webdings">
<Button Padding="10,6" VerticalAlignment="Top" Name="PART_MaximizeButton" Click="maximizeButton_Click" Focusable="False" WindowChrome.IsHitTestVisibleInChrome="True" Content="1" bs:MarkupExtensionProperties.CornerRadius="0" BorderBrush="Transparent" FontFamily="Webdings" /> <Button.Background>
<Button Padding="10,6" Name="PART_CloseButton" Click="closeButton_Click" Focusable="False" WindowChrome.IsHitTestVisibleInChrome="True" Content="r" bs:MarkupExtensionProperties.CornerRadius="0" BorderBrush="Transparent" FontFamily="Webdings"> <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="Transparent" Offset="0.0"/>
</LinearGradientBrush>
</Button.Background>
<Button.Resources>
<LinearGradientBrush x:Key="DarkBrush" EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#FF8A8A8A" Offset="0"/>
</LinearGradientBrush>
</Button.Resources>
</Button>
<Button Padding="10,6" VerticalAlignment="Top" Name="PART_MaximizeButton" Click="maximizeButton_Click" Focusable="False" WindowChrome.IsHitTestVisibleInChrome="True" Content="1" bs:MarkupExtensionProperties.CornerRadius="0" BorderThickness="0" FontFamily="Webdings">
<Button.Background>
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="Transparent" Offset="0.0"/>
</LinearGradientBrush>
</Button.Background>
<Button.Resources>
<LinearGradientBrush x:Key="DarkBrush" EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#FF8A8A8A" Offset="0"/>
</LinearGradientBrush>
</Button.Resources>
</Button>
<Button Padding="10,6" Name="PART_CloseButton" Click="closeButton_Click" Focusable="False" WindowChrome.IsHitTestVisibleInChrome="True" Content="r" bs:MarkupExtensionProperties.CornerRadius="0" BorderThickness="0" FontFamily="Webdings">
<Button.Background> <Button.Background>
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0"> <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="Transparent" Offset="0.0"/> <GradientStop Color="Transparent" Offset="0.0"/>
@@ -5694,15 +5707,14 @@
<Button.Resources> <Button.Resources>
<LinearGradientBrush x:Key="DarkBrush" EndPoint="0,1" StartPoint="0,0"> <LinearGradientBrush x:Key="DarkBrush" EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#FFFF8A8A" Offset="0"/> <GradientStop Color="#FFFF8A8A" Offset="0"/>
<GradientStop Color="#FFD14D4D" Offset="1"/>
</LinearGradientBrush> </LinearGradientBrush>
</Button.Resources> </Button.Resources>
</Button> </Button>
</StackPanel> </StackPanel>
<Label Padding="0,5" Foreground="White" HorizontalContentAlignment="{TemplateBinding bs:MarkupExtensionProperties.HeaderHorizontalAlignment}" Content="{TemplateBinding bs:MarkupExtensionProperties.Header}" FontSize="14"> <Label Padding="0,5" Foreground="{DynamicResource OnWindowForegroundBrush}" HorizontalContentAlignment="{TemplateBinding bs:MarkupExtensionProperties.HeaderHorizontalAlignment}" Content="{TemplateBinding bs:MarkupExtensionProperties.Header}" FontSize="14">
<Label.Effect> <!--<Label.Effect>
<DropShadowEffect BlurRadius="2" ShadowDepth="1" Color="Black" /> <DropShadowEffect BlurRadius="2" ShadowDepth="1" Color="White" />
</Label.Effect> </Label.Effect>-->
</Label> </Label>
</DockPanel> </DockPanel>
</Border> </Border>

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Threading; using System.Windows.Threading;
@@ -19,49 +20,49 @@ namespace BrightSharp.Themes
public static class ThemeManager public static class ThemeManager
{ {
private const string StyleDictionaryPattern = @"(?<=.+style\.)(.*?)(?=\.xaml)"; private const string StyleDictionaryPattern = @"(?<=.+style\.)(.*?)(?=\.xaml)";
private const string StaticThemeDictionaryUri = "/brightsharp;component/themes/theme.static.xaml"; private const string ThemeDictionaryUri = "/brightsharp;component/themes/theme.xaml";
static ColorThemes? _theme; private static ColorThemes? ThemeField;
public static ColorThemes? Theme public static ColorThemes? Theme
{ {
get { get {
if (_theme.HasValue) return _theme.Value; if (ThemeField.HasValue) return ThemeField.Value;
var curStyleRes = Resources.Where(r => r.Source != null && var curStyleRes = Resources.Where(r => r.Source != null &&
Regex.IsMatch(r.Source.OriginalString, StyleDictionaryPattern, RegexOptions.IgnoreCase)).FirstOrDefault(); Regex.IsMatch(r.Source.OriginalString, StyleDictionaryPattern, RegexOptions.IgnoreCase)).FirstOrDefault();
if (curStyleRes == null) return null; if (curStyleRes == null) return null;
var match = Regex.Match(curStyleRes.Source.OriginalString, StyleDictionaryPattern, RegexOptions.IgnoreCase); var match = Regex.Match(curStyleRes.Source.OriginalString, StyleDictionaryPattern, RegexOptions.IgnoreCase);
_theme = (ColorThemes)Enum.Parse(typeof(ColorThemes), match.Value, true); ThemeField = (ColorThemes)Enum.Parse(typeof(ColorThemes), match.Value, true);
return _theme.Value; return ThemeField.Value;
} }
set { set {
SetTheme(value); _ = SetTheme(value);
} }
} }
public static DispatcherOperation SetTheme(ColorThemes? value, DispatcherPriority priority = DispatcherPriority.Background) { public static async Task SetTheme(ColorThemes? value, DispatcherPriority priority = DispatcherPriority.Background)
if (_theme == value) return Application.Current.Dispatcher.BeginInvoke(new Action(() => { }), priority);
_theme = value;
return Application.Current.Dispatcher.BeginInvoke(new Action(() =>
{ {
if (_theme != value) return; if (ThemeField == value) { return; }
ThemeField = value;
await Application.Current.Dispatcher.InvokeAsync(() =>
{
if (ThemeField != value) return;
Application.Current.Resources.BeginInit(); Application.Current.Resources.BeginInit();
var curStyleRes = Resources.Where(r => r.Source != null && var curStyleRes = Resources.Where(r => r.Source != null &&
Regex.IsMatch(r.Source.OriginalString, StyleDictionaryPattern, RegexOptions.IgnoreCase)).FirstOrDefault(); Regex.IsMatch(r.Source.OriginalString, StyleDictionaryPattern, RegexOptions.IgnoreCase)).FirstOrDefault();
var curThemeRes = Resources.Where(r => r.Source != null && r.Source.OriginalString.Equals(StaticThemeDictionaryUri, StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault(); var curThemeRes = Resources.Where(r => r.Source != null && r.Source.OriginalString.Equals(ThemeDictionaryUri, StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault();
if (curThemeRes != null) if (curThemeRes != null)
Resources.Remove(curThemeRes); Resources.Remove(curThemeRes);
if (curStyleRes != null) if (curStyleRes != null)
Resources.Remove(curStyleRes); Resources.Remove(curStyleRes);
if (value == null) return; if (value == null) return;
Resources.Add(new ResourceDictionary() { Source = new Uri($"/brightsharp;component/themes/style.{value}.xaml", UriKind.RelativeOrAbsolute) }); Resources.Add(new ResourceDictionary() { Source = new Uri($"/brightsharp;component/themes/style.{value}.xaml", UriKind.RelativeOrAbsolute) });
if (curThemeRes != null) Resources.Add(new ResourceDictionary() { Source = new Uri(ThemeDictionaryUri, UriKind.RelativeOrAbsolute) });
Resources.Add(new ResourceDictionary() { Source = new Uri(StaticThemeDictionaryUri, UriKind.RelativeOrAbsolute) });
Application.Current.Resources.EndInit(); Application.Current.Resources.EndInit();
ThemeChanged?.Invoke(null, EventArgs.Empty); ThemeChanged?.Invoke(null, EventArgs.Empty);
}), priority); }, priority);
} }
public static event EventHandler ThemeChanged; public static event EventHandler ThemeChanged;