mirror of
https://github.com/VitalickS/BrightSharp.Toolkit.git
synced 2026-03-21 10:21:16 +00:00
.net copy
This commit is contained in:
26
BrightSharp.NET/AssemblyInfo.cs
Normal file
26
BrightSharp.NET/AssemblyInfo.cs
Normal 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")]
|
||||
117
BrightSharp.NET/Behaviors/FilterDefaultViewTextBoxBehavior.cs
Normal file
117
BrightSharp.NET/Behaviors/FilterDefaultViewTextBoxBehavior.cs
Normal file
@@ -0,0 +1,117 @@
|
||||
using Microsoft.Xaml.Behaviors;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace BrightSharp.Behaviors
|
||||
{
|
||||
public class FilterDefaultViewTextBoxBehavior : Behavior<TextBox>
|
||||
{
|
||||
readonly DispatcherTimer _timer = new DispatcherTimer();
|
||||
|
||||
public FilterDefaultViewTextBoxBehavior()
|
||||
{
|
||||
_timer.Tick += Timer_Tick;
|
||||
FilterDelay = TimeSpan.FromSeconds(1);
|
||||
IgnoreCase = null; //Case sensitive if any char upper case
|
||||
FilterStringPropertyName = "FilterString";
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void Timer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
_timer.Stop();
|
||||
if (ItemsSource != null)
|
||||
{
|
||||
var view = CollectionViewSource.GetDefaultView(ItemsSource);
|
||||
if (view is ListCollectionView)
|
||||
{
|
||||
var listCollectionView = (ListCollectionView)view;
|
||||
if (listCollectionView.IsAddingNew || listCollectionView.IsEditingItem) return;
|
||||
}
|
||||
view.Filter = CustomFilter ?? GetDefaultFilter(ItemsSource.GetType().GetGenericArguments()[0]);
|
||||
}
|
||||
}
|
||||
|
||||
public string FilterStringPropertyName { get; set; }
|
||||
|
||||
public bool HasFilterText
|
||||
{
|
||||
get { return (bool)GetValue(HasFilterTextProperty); }
|
||||
set { SetValue(HasFilterTextProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty HasFilterTextProperty =
|
||||
DependencyProperty.Register("HasFilterText", typeof(bool), typeof(FilterDefaultViewTextBoxBehavior), new PropertyMetadata(false));
|
||||
|
||||
|
||||
|
||||
public IEnumerable ItemsSource
|
||||
{
|
||||
get { return (IEnumerable)GetValue(ItemsSourceProperty); }
|
||||
set { SetValue(ItemsSourceProperty, value); }
|
||||
}
|
||||
|
||||
// Using a DependencyProperty as the backing store for ItemsSource. This enables animation, styling, binding, etc...
|
||||
public static readonly DependencyProperty ItemsSourceProperty =
|
||||
DependencyProperty.Register("ItemsSource", typeof(IEnumerable), typeof(FilterDefaultViewTextBoxBehavior), new PropertyMetadata(null));
|
||||
|
||||
|
||||
public bool? IgnoreCase { get; set; }
|
||||
private Predicate<object> GetDefaultFilter(Type filterItemType)
|
||||
{
|
||||
Func<object, string> dataFunc;
|
||||
var pInfo = filterItemType.GetProperty(FilterStringPropertyName);
|
||||
if (pInfo == null)
|
||||
{
|
||||
dataFunc = (x) => string.Join(",", filterItemType.GetProperties().Where(p => !p.Name.EndsWith("Id")).Select(p => (p.GetValue(x, null) ?? string.Empty).ToString()));
|
||||
}
|
||||
else
|
||||
{
|
||||
dataFunc = (x) => (pInfo.GetValue(x, null) ?? string.Empty).ToString();
|
||||
}
|
||||
var filterText = AssociatedObject.Text;
|
||||
var ic = IgnoreCase ?? !filterText.Any(char.IsUpper);
|
||||
return x =>
|
||||
{
|
||||
if (x == null || string.IsNullOrEmpty(filterText)) return true;
|
||||
var propValStr = dataFunc(x);
|
||||
foreach (var item in filterText.Split(';'))
|
||||
{
|
||||
if (propValStr.IndexOf(item, ic ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal) == -1)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
public Predicate<object> CustomFilter { get; set; }
|
||||
|
||||
public TimeSpan FilterDelay { get { return _timer.Interval; } set { _timer.Interval = value; } }
|
||||
|
||||
protected override void OnAttached()
|
||||
{
|
||||
base.OnAttached();
|
||||
HasFilterText = !string.IsNullOrEmpty(AssociatedObject.Text);
|
||||
AssociatedObject.TextChanged += AssociatedObject_TextChanged;
|
||||
}
|
||||
|
||||
private void AssociatedObject_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
_timer.Stop(); _timer.Start();
|
||||
HasFilterText = !string.IsNullOrEmpty(AssociatedObject.Text);
|
||||
}
|
||||
|
||||
protected override void OnDetaching()
|
||||
{
|
||||
AssociatedObject.TextChanged -= AssociatedObject_TextChanged;
|
||||
_timer.Tick -= Timer_Tick;
|
||||
base.OnDetaching();
|
||||
}
|
||||
}
|
||||
}
|
||||
80
BrightSharp.NET/Behaviors/MinMaxSize_Logic.cs
Normal file
80
BrightSharp.NET/Behaviors/MinMaxSize_Logic.cs
Normal file
@@ -0,0 +1,80 @@
|
||||
using BrightSharp.Interop;
|
||||
using BrightSharp.Interop.Constants;
|
||||
using BrightSharp.Interop.Structures;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
using System.Windows.Interop;
|
||||
|
||||
namespace BrightSharp.Behaviors
|
||||
{
|
||||
internal class MinMaxSize_Logic
|
||||
{
|
||||
private HwndSource hwndSource;
|
||||
private Window associatedObject;
|
||||
public MinMaxSize_Logic(Window associatedObject)
|
||||
{
|
||||
this.associatedObject = associatedObject;
|
||||
}
|
||||
public void OnAttached()
|
||||
{
|
||||
this.associatedObject.SourceInitialized += AssociatedObject_SourceInitialized;
|
||||
}
|
||||
|
||||
private void AssociatedObject_SourceInitialized(object sender, EventArgs e)
|
||||
{
|
||||
IntPtr handle = new WindowInteropHelper(this.associatedObject).Handle;
|
||||
hwndSource = HwndSource.FromHwnd(handle);
|
||||
hwndSource.AddHook(WindowProc);
|
||||
}
|
||||
|
||||
public void OnDetaching()
|
||||
{
|
||||
this.associatedObject.SourceInitialized -= AssociatedObject_SourceInitialized;
|
||||
if (hwndSource != null)
|
||||
{
|
||||
hwndSource.RemoveHook(WindowProc);
|
||||
hwndSource.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
[DebuggerStepThrough]
|
||||
private IntPtr WindowProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
case 0x0024:
|
||||
WmGetMinMaxInfo(hwnd, lParam);
|
||||
handled = true;
|
||||
break;
|
||||
}
|
||||
return (IntPtr)0;
|
||||
}
|
||||
|
||||
private void WmGetMinMaxInfo(IntPtr hwnd, IntPtr lParam)
|
||||
{
|
||||
var mmi = (MINMAXINFO)Marshal.PtrToStructure(lParam, typeof(MINMAXINFO));
|
||||
|
||||
// Adjust the maximized size and position to fit the work area of the correct monitor
|
||||
IntPtr monitor = NativeMethods.MonitorFromWindow(hwnd, (int)MonitorFromWindowFlags.MONITOR_DEFAULTTONEAREST);
|
||||
|
||||
if (monitor != IntPtr.Zero)
|
||||
{
|
||||
var monitorInfo = new MONITORINFO();
|
||||
NativeMethods.GetMonitorInfo(monitor, monitorInfo);
|
||||
RECT rcWorkArea = monitorInfo.rcWork;
|
||||
RECT rcMonitorArea = monitorInfo.rcMonitor;
|
||||
mmi.ptMaxPosition.x = Math.Abs(rcWorkArea.Left - rcMonitorArea.Left);
|
||||
mmi.ptMaxPosition.y = Math.Abs(rcWorkArea.Top - rcMonitorArea.Top);
|
||||
mmi.ptMaxSize.x = Math.Abs(rcWorkArea.Right - rcWorkArea.Left);
|
||||
mmi.ptMaxSize.y = Math.Abs(rcWorkArea.Bottom - rcWorkArea.Top);
|
||||
mmi.ptMinTrackSize.x = (int)associatedObject.MinWidth;
|
||||
mmi.ptMinTrackSize.y = (int)associatedObject.MinHeight;
|
||||
}
|
||||
|
||||
Marshal.StructureToPtr(mmi, lParam, true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
33
BrightSharp.NET/Behaviors/SelectAllTextOnFocusBehavior.cs
Normal file
33
BrightSharp.NET/Behaviors/SelectAllTextOnFocusBehavior.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using Microsoft.Xaml.Behaviors;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace BrightSharp.Behaviors
|
||||
{
|
||||
public class SelectAllTextOnFocusBehavior : Behavior<TextBoxBase>
|
||||
{
|
||||
protected override void OnAttached() {
|
||||
base.OnAttached();
|
||||
AssociatedObject.GotKeyboardFocus += AssociatedObjectGotKeyboardFocus;
|
||||
AssociatedObject.PreviewMouseLeftButtonDown += AssociatedObjectPreviewMouseLeftButtonDown;
|
||||
}
|
||||
|
||||
protected override void OnDetaching() {
|
||||
base.OnDetaching();
|
||||
AssociatedObject.GotKeyboardFocus -= AssociatedObjectGotKeyboardFocus;
|
||||
AssociatedObject.PreviewMouseLeftButtonDown -= AssociatedObjectPreviewMouseLeftButtonDown;
|
||||
}
|
||||
|
||||
private void AssociatedObjectGotKeyboardFocus(object sender,
|
||||
KeyboardFocusChangedEventArgs e) {
|
||||
AssociatedObject.SelectAll();
|
||||
}
|
||||
|
||||
private void AssociatedObjectPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) {
|
||||
if (!AssociatedObject.IsKeyboardFocusWithin) {
|
||||
AssociatedObject.Focus();
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
23
BrightSharp.NET/Behaviors/WindowMinMaxSizeBehavior.cs
Normal file
23
BrightSharp.NET/Behaviors/WindowMinMaxSizeBehavior.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Microsoft.Xaml.Behaviors;
|
||||
using System.Windows;
|
||||
|
||||
namespace BrightSharp.Behaviors
|
||||
{
|
||||
public class WindowMinMaxSizeBehavior : Behavior<Window>
|
||||
{
|
||||
private MinMaxSize_Logic _logic;
|
||||
protected override void OnAttached()
|
||||
{
|
||||
base.OnAttached();
|
||||
_logic = new MinMaxSize_Logic(AssociatedObject);
|
||||
_logic.OnAttached();
|
||||
}
|
||||
|
||||
|
||||
protected override void OnDetaching()
|
||||
{
|
||||
_logic.OnDetaching();
|
||||
base.OnDetaching();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Interactivity;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace BrightSharp.Behaviors
|
||||
{
|
||||
public class FilterDefaultViewTextBoxBehavior : Behavior<TextBox>
|
||||
{
|
||||
readonly DispatcherTimer _timer = new DispatcherTimer();
|
||||
|
||||
public FilterDefaultViewTextBoxBehavior()
|
||||
{
|
||||
_timer.Tick += Timer_Tick;
|
||||
FilterDelay = TimeSpan.FromSeconds(1);
|
||||
IgnoreCase = null; //Case sensitive if any char upper case
|
||||
FilterStringPropertyName = "FilterString";
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void Timer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
_timer.Stop();
|
||||
if (ItemsSource != null)
|
||||
{
|
||||
var view = CollectionViewSource.GetDefaultView(ItemsSource);
|
||||
if (view is ListCollectionView)
|
||||
{
|
||||
var listCollectionView = (ListCollectionView)view;
|
||||
if (listCollectionView.IsAddingNew || listCollectionView.IsEditingItem) return;
|
||||
}
|
||||
view.Filter = CustomFilter ?? GetDefaultFilter(ItemsSource.GetType().GetGenericArguments()[0]);
|
||||
}
|
||||
}
|
||||
|
||||
public string FilterStringPropertyName { get; set; }
|
||||
|
||||
public bool HasFilterText
|
||||
{
|
||||
get { return (bool)GetValue(HasFilterTextProperty); }
|
||||
set { SetValue(HasFilterTextProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty HasFilterTextProperty =
|
||||
DependencyProperty.Register("HasFilterText", typeof(bool), typeof(FilterDefaultViewTextBoxBehavior), new PropertyMetadata(false));
|
||||
|
||||
|
||||
|
||||
public IEnumerable ItemsSource
|
||||
{
|
||||
get { return (IEnumerable)GetValue(ItemsSourceProperty); }
|
||||
set { SetValue(ItemsSourceProperty, value); }
|
||||
}
|
||||
|
||||
// Using a DependencyProperty as the backing store for ItemsSource. This enables animation, styling, binding, etc...
|
||||
public static readonly DependencyProperty ItemsSourceProperty =
|
||||
DependencyProperty.Register("ItemsSource", typeof(IEnumerable), typeof(FilterDefaultViewTextBoxBehavior), new PropertyMetadata(null));
|
||||
|
||||
|
||||
public bool? IgnoreCase { get; set; }
|
||||
private Predicate<object> GetDefaultFilter(Type filterItemType)
|
||||
{
|
||||
Func<object, string> dataFunc;
|
||||
var pInfo = filterItemType.GetProperty(FilterStringPropertyName);
|
||||
if (pInfo == null)
|
||||
{
|
||||
dataFunc = (x) => string.Join(",", filterItemType.GetProperties().Where(p => !p.Name.EndsWith("Id")).Select(p => (p.GetValue(x, null) ?? string.Empty).ToString()));
|
||||
}
|
||||
else
|
||||
{
|
||||
dataFunc = (x) => (pInfo.GetValue(x, null) ?? string.Empty).ToString();
|
||||
}
|
||||
var filterText = AssociatedObject.Text;
|
||||
var ic = IgnoreCase ?? !filterText.Any(char.IsUpper);
|
||||
return x =>
|
||||
{
|
||||
if (x == null || string.IsNullOrEmpty(filterText)) return true;
|
||||
var propValStr = dataFunc(x);
|
||||
foreach (var item in filterText.Split(';'))
|
||||
{
|
||||
if (propValStr.IndexOf(item, ic ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal) == -1)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
public Predicate<object> CustomFilter { get; set; }
|
||||
|
||||
public TimeSpan FilterDelay { get { return _timer.Interval; } set { _timer.Interval = value; } }
|
||||
|
||||
protected override void OnAttached()
|
||||
{
|
||||
base.OnAttached();
|
||||
HasFilterText = !string.IsNullOrEmpty(AssociatedObject.Text);
|
||||
AssociatedObject.TextChanged += AssociatedObject_TextChanged;
|
||||
}
|
||||
|
||||
private void AssociatedObject_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
_timer.Stop(); _timer.Start();
|
||||
HasFilterText = !string.IsNullOrEmpty(AssociatedObject.Text);
|
||||
}
|
||||
|
||||
protected override void OnDetaching()
|
||||
{
|
||||
AssociatedObject.TextChanged -= AssociatedObject_TextChanged;
|
||||
_timer.Tick -= Timer_Tick;
|
||||
base.OnDetaching();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
using BrightSharp.Interop;
|
||||
using BrightSharp.Interop.Constants;
|
||||
using BrightSharp.Interop.Structures;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
using System.Windows.Interop;
|
||||
|
||||
namespace BrightSharp.Behaviors
|
||||
{
|
||||
internal class MinMaxSize_Logic
|
||||
{
|
||||
private HwndSource hwndSource;
|
||||
private Window associatedObject;
|
||||
public MinMaxSize_Logic(Window associatedObject)
|
||||
{
|
||||
this.associatedObject = associatedObject;
|
||||
}
|
||||
public void OnAttached()
|
||||
{
|
||||
this.associatedObject.SourceInitialized += AssociatedObject_SourceInitialized;
|
||||
}
|
||||
|
||||
private void AssociatedObject_SourceInitialized(object sender, EventArgs e)
|
||||
{
|
||||
IntPtr handle = new WindowInteropHelper(this.associatedObject).Handle;
|
||||
hwndSource = HwndSource.FromHwnd(handle);
|
||||
hwndSource.AddHook(WindowProc);
|
||||
}
|
||||
|
||||
public void OnDetaching()
|
||||
{
|
||||
this.associatedObject.SourceInitialized -= AssociatedObject_SourceInitialized;
|
||||
if (hwndSource != null)
|
||||
{
|
||||
hwndSource.RemoveHook(WindowProc);
|
||||
hwndSource.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
[DebuggerStepThrough]
|
||||
private IntPtr WindowProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
case 0x0024:
|
||||
WmGetMinMaxInfo(hwnd, lParam);
|
||||
handled = true;
|
||||
break;
|
||||
}
|
||||
return (IntPtr)0;
|
||||
}
|
||||
|
||||
private void WmGetMinMaxInfo(IntPtr hwnd, IntPtr lParam)
|
||||
{
|
||||
var mmi = (MINMAXINFO)Marshal.PtrToStructure(lParam, typeof(MINMAXINFO));
|
||||
|
||||
// Adjust the maximized size and position to fit the work area of the correct monitor
|
||||
IntPtr monitor = NativeMethods.MonitorFromWindow(hwnd, (int)MonitorFromWindowFlags.MONITOR_DEFAULTTONEAREST);
|
||||
|
||||
if (monitor != IntPtr.Zero)
|
||||
{
|
||||
var monitorInfo = new MONITORINFO();
|
||||
NativeMethods.GetMonitorInfo(monitor, monitorInfo);
|
||||
RECT rcWorkArea = monitorInfo.rcWork;
|
||||
RECT rcMonitorArea = monitorInfo.rcMonitor;
|
||||
mmi.ptMaxPosition.x = Math.Abs(rcWorkArea.Left - rcMonitorArea.Left);
|
||||
mmi.ptMaxPosition.y = Math.Abs(rcWorkArea.Top - rcMonitorArea.Top);
|
||||
mmi.ptMaxSize.x = Math.Abs(rcWorkArea.Right - rcWorkArea.Left);
|
||||
mmi.ptMaxSize.y = Math.Abs(rcWorkArea.Bottom - rcWorkArea.Top);
|
||||
mmi.ptMinTrackSize.x = (int)associatedObject.MinWidth;
|
||||
mmi.ptMinTrackSize.y = (int)associatedObject.MinHeight;
|
||||
}
|
||||
|
||||
Marshal.StructureToPtr(mmi, lParam, true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interactivity;
|
||||
|
||||
namespace BrightSharp.Behaviors
|
||||
{
|
||||
public class SelectAllTextOnFocusBehavior : Behavior<TextBoxBase>
|
||||
{
|
||||
protected override void OnAttached() {
|
||||
base.OnAttached();
|
||||
AssociatedObject.GotKeyboardFocus += AssociatedObjectGotKeyboardFocus;
|
||||
AssociatedObject.PreviewMouseLeftButtonDown += AssociatedObjectPreviewMouseLeftButtonDown;
|
||||
}
|
||||
|
||||
protected override void OnDetaching() {
|
||||
base.OnDetaching();
|
||||
AssociatedObject.GotKeyboardFocus -= AssociatedObjectGotKeyboardFocus;
|
||||
AssociatedObject.PreviewMouseLeftButtonDown -= AssociatedObjectPreviewMouseLeftButtonDown;
|
||||
}
|
||||
|
||||
private void AssociatedObjectGotKeyboardFocus(object sender,
|
||||
KeyboardFocusChangedEventArgs e) {
|
||||
AssociatedObject.SelectAll();
|
||||
}
|
||||
|
||||
private void AssociatedObjectPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) {
|
||||
if (!AssociatedObject.IsKeyboardFocusWithin) {
|
||||
AssociatedObject.Focus();
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Interactivity;
|
||||
|
||||
namespace BrightSharp.Behaviors
|
||||
{
|
||||
public class WindowMinMaxSizeBehavior : Behavior<Window>
|
||||
{
|
||||
private MinMaxSize_Logic _logic;
|
||||
protected override void OnAttached()
|
||||
{
|
||||
base.OnAttached();
|
||||
_logic = new MinMaxSize_Logic(AssociatedObject);
|
||||
_logic.OnAttached();
|
||||
}
|
||||
|
||||
|
||||
protected override void OnDetaching()
|
||||
{
|
||||
_logic.OnDetaching();
|
||||
base.OnDetaching();
|
||||
}
|
||||
}
|
||||
}
|
||||
170
BrightSharp.NET/BrightSharp.NET/BrightSharp.NET.csproj
Normal file
170
BrightSharp.NET/BrightSharp.NET/BrightSharp.NET.csproj
Normal file
@@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{E6D5870A-A71E-47C1-9D5F-1E49CB4F6D4C}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>BrightSharp</RootNamespace>
|
||||
<AssemblyName>BrightSharp</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject />
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.Expression.Interactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\..\packages\System.Windows.Interactivity.WPF.2.0.20525\lib\net40\Microsoft.Expression.Interactions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Windows.Interactivity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\..\packages\System.Windows.Interactivity.WPF.2.0.20525\lib\net40\System.Windows.Interactivity.dll</HintPath>
|
||||
</Reference>
|
||||
<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.Net.Http" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Extensions\MarkupExtensionProperties.cs" />
|
||||
<Compile Include="Extensions\WpfExtensions.cs" />
|
||||
<Compile Include="Themes\Theme.cs" />
|
||||
<Compile Include="Themes\Theme.Static.cs" />
|
||||
<Compile Include="Themes\ThemeManager.cs" />
|
||||
<Compile Include="Behaviors\FilterDefaultViewTextBoxBehavior.cs" />
|
||||
<Compile Include="Behaviors\MinMaxSize_Logic.cs" />
|
||||
<Compile Include="Behaviors\SelectAllTextOnFocusBehavior.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="Converters\ThicknessConverter.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\SelectionBehavior.cs" />
|
||||
<Compile Include="Diagrams\Thumbs\MoveThumb.cs" />
|
||||
<Compile Include="Diagrams\Thumbs\ResizeThumb.cs" />
|
||||
<Compile Include="Diagrams\Thumbs\RotateThumb.cs" />
|
||||
<Compile Include="Diagrams\VisualExtensions.cs" />
|
||||
<Compile Include="Diagrams\ZoomControl.cs" />
|
||||
<Compile Include="Interop\Constants.cs" />
|
||||
<Compile Include="Interop\NativeMethods.cs" />
|
||||
<Compile Include="Interop\Structures.cs" />
|
||||
<Page Include="Themes\Controls\ZoomControl.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<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\Generic.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">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Themes\Style.DarkBlue.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\Style.Silver.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Themes\Theme.Static.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Themes\Theme.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<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="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Themes\icons\app.png" />
|
||||
<Resource Include="Themes\icons\copy.png" />
|
||||
<Resource Include="Themes\icons\cut.png" />
|
||||
<Resource Include="Themes\icons\paste.png" />
|
||||
<Resource Include="Themes\icons\undo.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
74
BrightSharp.NET/BrightSharp.NET/Commands/AsyncCommand.cs
Normal file
74
BrightSharp.NET/BrightSharp.NET/Commands/AsyncCommand.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace BrightSharp.Commands
|
||||
{
|
||||
public class AsyncCommand : ICommand
|
||||
{
|
||||
private readonly Func<object, Task> _execute;
|
||||
private readonly Func<object, bool> _canExecute;
|
||||
private Action _onComplete;
|
||||
private Action<Exception> _onFail;
|
||||
private bool _isExecuting;
|
||||
|
||||
public AsyncCommand(Func<Task> execute) : this(p => execute?.Invoke())
|
||||
{
|
||||
}
|
||||
|
||||
public AsyncCommand(Func<object, Task> execute) : this(execute, o => true)
|
||||
{
|
||||
}
|
||||
|
||||
public AsyncCommand(Func<object, Task> execute, Func<object, bool> canExecute)
|
||||
{
|
||||
_execute = execute;
|
||||
_canExecute = canExecute;
|
||||
}
|
||||
|
||||
public AsyncCommand OnComplete(Action onComplete)
|
||||
{
|
||||
_onComplete = onComplete;
|
||||
return this;
|
||||
}
|
||||
public AsyncCommand OnFail(Action<Exception> onFail)
|
||||
{
|
||||
_onFail = onFail;
|
||||
return this;
|
||||
}
|
||||
|
||||
public bool CanExecute(object parameter)
|
||||
{
|
||||
return !_isExecuting && _canExecute(parameter);
|
||||
}
|
||||
|
||||
public event EventHandler CanExecuteChanged;
|
||||
|
||||
public async void Execute(object parameter)
|
||||
{
|
||||
_isExecuting = true;
|
||||
OnCanExecuteChanged();
|
||||
try
|
||||
{
|
||||
await _execute(parameter);
|
||||
_onComplete?.Invoke();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
while (ex.InnerException != null)
|
||||
ex = ex.InnerException;
|
||||
_onFail?.Invoke(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_isExecuting = false;
|
||||
OnCanExecuteChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void OnCanExecuteChanged()
|
||||
{
|
||||
CanExecuteChanged?.Invoke(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
}
|
||||
71
BrightSharp.NET/BrightSharp.NET/Commands/RelayCommand.cs
Normal file
71
BrightSharp.NET/BrightSharp.NET/Commands/RelayCommand.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace BrightSharp.Commands
|
||||
{
|
||||
public class RelayCommand : ICommand
|
||||
{
|
||||
private readonly Action _methodToExecute;
|
||||
private readonly Action<object> _methodToExecuteWithParam;
|
||||
private readonly Func<object, bool> _canExecuteEvaluator;
|
||||
|
||||
public event EventHandler CanExecuteChanged
|
||||
{
|
||||
add { CommandManager.RequerySuggested += value; }
|
||||
remove { CommandManager.RequerySuggested -= value; }
|
||||
}
|
||||
|
||||
public RelayCommand(Action<object> methodToExecute, Func<object, bool> canExecuteEvaluator = null)
|
||||
{
|
||||
_methodToExecuteWithParam = methodToExecute;
|
||||
_canExecuteEvaluator = canExecuteEvaluator;
|
||||
}
|
||||
|
||||
public RelayCommand(Action methodToExecute)
|
||||
{
|
||||
_methodToExecute = methodToExecute;
|
||||
}
|
||||
|
||||
public bool CanExecute(object parameter)
|
||||
{
|
||||
if (_canExecuteEvaluator == null)
|
||||
return true;
|
||||
else
|
||||
return _canExecuteEvaluator.Invoke(parameter);
|
||||
}
|
||||
public void Execute(object parameter)
|
||||
{
|
||||
_methodToExecuteWithParam?.Invoke(parameter);
|
||||
_methodToExecute?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
public class RelayCommand<T> : ICommand where T : class
|
||||
{
|
||||
private readonly Action<T> _methodToExecuteWithParam;
|
||||
private readonly Func<T, bool> _canExecuteEvaluator;
|
||||
|
||||
public event EventHandler CanExecuteChanged
|
||||
{
|
||||
add { CommandManager.RequerySuggested += value; }
|
||||
remove { CommandManager.RequerySuggested -= value; }
|
||||
}
|
||||
|
||||
public RelayCommand(Action<T> methodToExecute, Func<T, bool> canExecuteEvaluator = null)
|
||||
{
|
||||
_methodToExecuteWithParam = methodToExecute;
|
||||
_canExecuteEvaluator = canExecuteEvaluator;
|
||||
}
|
||||
|
||||
public bool CanExecute(object parameter)
|
||||
{
|
||||
if (_canExecuteEvaluator == null)
|
||||
return true;
|
||||
return _canExecuteEvaluator.Invoke(parameter as T);
|
||||
}
|
||||
public void Execute(object parameter)
|
||||
{
|
||||
_methodToExecuteWithParam?.Invoke(parameter as T);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace BrightSharp.Converters
|
||||
{
|
||||
public class IntToValueConverter : IValueConverter
|
||||
{
|
||||
public ulong? TrueValueInt { get; set; } = null;
|
||||
public ulong? FalseValueInt { get; set; } = 0;
|
||||
|
||||
|
||||
public object TrueValue { get; set; } = true;
|
||||
public object FalseValue { get; set; } = false;
|
||||
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
value = false;
|
||||
}
|
||||
if (value is string valueStr)
|
||||
{
|
||||
value = valueStr.Length > 0;
|
||||
}
|
||||
if (value is bool valueBool)
|
||||
{
|
||||
value = valueBool ? 1 : 0;
|
||||
}
|
||||
if (value is ICollection valueCol)
|
||||
{
|
||||
value = valueCol.Count;
|
||||
}
|
||||
if (value is Enum en)
|
||||
{
|
||||
value = System.Convert.ToInt32(en);
|
||||
}
|
||||
if (ulong.TryParse(value.ToString(), out ulong valueLong))
|
||||
{
|
||||
// Exact match for false
|
||||
if (FalseValueInt.HasValue && FalseValueInt == valueLong) return FalseValue;
|
||||
// Exact match for true
|
||||
if (TrueValueInt.HasValue && TrueValueInt == valueLong) return TrueValue;
|
||||
// Any value for false
|
||||
if (!FalseValueInt.HasValue) return FalseValue;
|
||||
// Any value for true
|
||||
if (!TrueValueInt.HasValue) return TrueValue;
|
||||
}
|
||||
return TrueValue;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
// Convert with potential lose exact value match
|
||||
return Equals(value, TrueValue) ? TrueValueInt : FalseValueInt;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace BrightSharp.Converters
|
||||
{
|
||||
[Localizability(LocalizationCategory.NeverLocalize)]
|
||||
public class InverseBooleanToVisibilityConverter : IValueConverter
|
||||
{
|
||||
private BooleanToVisibilityConverter _converter = new BooleanToVisibilityConverter();
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
|
||||
var result = _converter.Convert(value, targetType, parameter, culture) as Visibility?;
|
||||
return result == Visibility.Collapsed ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
|
||||
var result = _converter.ConvertBack(value, targetType, parameter, culture) as bool?;
|
||||
return result == true ? false : true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace BrightSharp.Converters
|
||||
{
|
||||
internal class ThicknessConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if(value is Thickness)
|
||||
{
|
||||
var offset = double.Parse(parameter.ToString(), CultureInfo.InvariantCulture.NumberFormat);
|
||||
var thick = (Thickness)value;
|
||||
|
||||
return new Thickness(Math.Max(0, thick.Left + offset),
|
||||
Math.Max(0, thick.Top + offset),
|
||||
Math.Max(0, thick.Right + offset),
|
||||
Math.Max(0, thick.Bottom + offset));
|
||||
}
|
||||
else if(value is CornerRadius)
|
||||
{
|
||||
var offset = double.Parse(parameter.ToString(), CultureInfo.InvariantCulture.NumberFormat);
|
||||
var thick = (CornerRadius)value;
|
||||
|
||||
return new CornerRadius(Math.Max(0, thick.TopLeft + offset),
|
||||
Math.Max(0, thick.TopRight + offset),
|
||||
Math.Max(0, thick.BottomRight + offset),
|
||||
Math.Max(0, thick.BottomLeft + offset));
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace BrightSharp.Diagrams
|
||||
{
|
||||
[ToolboxItem(false)]
|
||||
public class ResizeRotateAdorner : Adorner
|
||||
{
|
||||
private VisualCollection visuals;
|
||||
private ResizeRotateChrome chrome;
|
||||
|
||||
protected override int VisualChildrenCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return visuals.Count;
|
||||
}
|
||||
}
|
||||
|
||||
public ResizeRotateAdorner(ContentControl designerItem)
|
||||
: base(designerItem)
|
||||
{
|
||||
SnapsToDevicePixels = true;
|
||||
chrome = new ResizeRotateChrome();
|
||||
chrome.DataContext = designerItem;
|
||||
visuals = new VisualCollection(this);
|
||||
visuals.Add(chrome);
|
||||
Focusable = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected override Size ArrangeOverride(Size arrangeBounds)
|
||||
{
|
||||
chrome.Arrange(new Rect(arrangeBounds));
|
||||
return arrangeBounds;
|
||||
}
|
||||
|
||||
protected override Visual GetVisualChild(int index)
|
||||
{
|
||||
return visuals[index];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace BrightSharp.Diagrams
|
||||
{
|
||||
[ToolboxItem(false)]
|
||||
public class ResizeRotateChrome : Control
|
||||
{
|
||||
static ResizeRotateChrome()
|
||||
{
|
||||
FrameworkElement.DefaultStyleKeyProperty.OverrideMetadata(typeof(ResizeRotateChrome), new FrameworkPropertyMetadata(typeof(ResizeRotateChrome)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace BrightSharp.Diagrams
|
||||
{
|
||||
[ToolboxItem(false)]
|
||||
public class SizeAdorner : Adorner
|
||||
{
|
||||
private SizeChrome chrome;
|
||||
private VisualCollection visuals;
|
||||
private FrameworkElement designerItem;
|
||||
|
||||
protected override int VisualChildrenCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return visuals.Count;
|
||||
}
|
||||
}
|
||||
|
||||
public SizeAdorner(FrameworkElement designerItem)
|
||||
: base(designerItem)
|
||||
{
|
||||
SnapsToDevicePixels = true;
|
||||
this.designerItem = designerItem;
|
||||
chrome = new SizeChrome();
|
||||
chrome.DataContext = designerItem;
|
||||
visuals = new VisualCollection(this);
|
||||
visuals.Add(chrome);
|
||||
}
|
||||
|
||||
protected override Visual GetVisualChild(int index)
|
||||
{
|
||||
return visuals[index];
|
||||
}
|
||||
|
||||
protected override Size ArrangeOverride(Size arrangeBounds)
|
||||
{
|
||||
chrome.Arrange(new Rect(new Point(0.0, 0.0), arrangeBounds));
|
||||
return arrangeBounds;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace BrightSharp.Diagrams
|
||||
{
|
||||
|
||||
[ToolboxItem(false)]
|
||||
public class SizeChrome : Control
|
||||
{
|
||||
static SizeChrome()
|
||||
{
|
||||
DefaultStyleKeyProperty.OverrideMetadata(typeof(SizeChrome), new FrameworkPropertyMetadata(typeof(SizeChrome)));
|
||||
}
|
||||
}
|
||||
|
||||
public class DoubleFormatConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
double d = (double)value;
|
||||
if (double.IsNaN(d)) return "(Auto)";
|
||||
return Math.Round(d);
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
using System;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Animation;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace BrightSharp.Diagrams
|
||||
{
|
||||
[ToolboxItem(false)]
|
||||
public class DesignerItemDecorator : Control
|
||||
{
|
||||
private Adorner adorner;
|
||||
|
||||
public bool ShowDecorator
|
||||
{
|
||||
get { return (bool)GetValue(ShowDecoratorProperty); }
|
||||
set { SetValue(ShowDecoratorProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty ShowDecoratorProperty =
|
||||
DependencyProperty.Register("ShowDecorator", typeof(bool), typeof(DesignerItemDecorator),
|
||||
new FrameworkPropertyMetadata(false, new PropertyChangedCallback(ShowDecoratorProperty_Changed)));
|
||||
|
||||
public DesignerItemDecorator()
|
||||
{
|
||||
Unloaded += new RoutedEventHandler(DesignerItemDecorator_Unloaded);
|
||||
}
|
||||
|
||||
private void HideAdorner()
|
||||
{
|
||||
if (adorner != null)
|
||||
{
|
||||
adorner.Visibility = Visibility.Hidden;
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowAdorner()
|
||||
{
|
||||
if (adorner == null)
|
||||
{
|
||||
AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this);
|
||||
|
||||
if (adornerLayer != null)
|
||||
{
|
||||
ContentControl designerItem = DataContext as ContentControl;
|
||||
Canvas canvas = VisualTreeHelper.GetParent(designerItem) as Canvas;
|
||||
adorner = new ResizeRotateAdorner(designerItem);
|
||||
adornerLayer.Add(adorner);
|
||||
|
||||
if (ShowDecorator)
|
||||
{
|
||||
adorner.Visibility = Visibility.Visible;
|
||||
|
||||
var anim = new DoubleAnimation(0, 1, TimeSpan.FromSeconds(.2));
|
||||
adorner.BeginAnimation(OpacityProperty, anim);
|
||||
}
|
||||
else
|
||||
{
|
||||
adorner.Visibility = Visibility.Hidden;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
adorner.Visibility = Visibility.Visible;
|
||||
|
||||
var anim = new DoubleAnimation(0, 1, TimeSpan.FromSeconds(.2));
|
||||
adorner.BeginAnimation(OpacityProperty, anim);
|
||||
}
|
||||
}
|
||||
|
||||
private void DesignerItemDecorator_Unloaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (adorner != null)
|
||||
{
|
||||
AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this);
|
||||
if (adornerLayer != null)
|
||||
{
|
||||
adornerLayer.Remove(adorner);
|
||||
}
|
||||
|
||||
adorner = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static void ShowDecoratorProperty_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
DesignerItemDecorator decorator = (DesignerItemDecorator)d;
|
||||
bool showDecorator = (bool)e.NewValue;
|
||||
|
||||
if (showDecorator)
|
||||
{
|
||||
decorator.ShowAdorner();
|
||||
}
|
||||
else
|
||||
{
|
||||
decorator.HideAdorner();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
using BrightSharp.Extensions;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
|
||||
namespace BrightSharp.Diagrams
|
||||
{
|
||||
public static class SelectionBehavior
|
||||
{
|
||||
public static void Attach(FrameworkElement fe)
|
||||
{
|
||||
FrameworkElement selectedControl = null;
|
||||
Style designerStyle = (Style)Application.Current.FindResource("DesignerItemStyle");
|
||||
if (fe is Panel)
|
||||
{
|
||||
var fePanel = (Panel)fe;
|
||||
fe.PreviewMouseLeftButtonDown += (s, e) =>
|
||||
{
|
||||
if (e.Source is DependencyObject)
|
||||
{
|
||||
var clickedElement = ((DependencyObject)e.OriginalSource).GetAncestors<ContentControl>().FirstOrDefault(el => el.Style == designerStyle && WpfExtensions.GetItemsPanel(el.GetParent(true)) == fe);
|
||||
if (clickedElement == null)
|
||||
{
|
||||
foreach (DependencyObject item in fePanel.Children)
|
||||
{
|
||||
Selector.SetIsSelected(item, false);
|
||||
}
|
||||
selectedControl = null;
|
||||
return;
|
||||
}
|
||||
foreach (var control in fePanel.Children.OfType<FrameworkElement>())
|
||||
{
|
||||
if (ProcessControl(control, clickedElement, ref selectedControl))
|
||||
{
|
||||
if (selectedControl is ContentControl cc && cc.Content is ButtonBase)
|
||||
{
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
else if (fe is ItemsControl)
|
||||
{
|
||||
var feItemsControl = (ItemsControl)fe;
|
||||
fe.PreviewMouseLeftButtonDown += (s, e) =>
|
||||
{
|
||||
if (e.Source is DependencyObject)
|
||||
{
|
||||
var clickedElement = ((DependencyObject)e.Source).GetAncestors<ContentControl>().FirstOrDefault(el => el.Style == designerStyle && el.Parent == fe);
|
||||
if (clickedElement == null)
|
||||
{
|
||||
foreach (DependencyObject item in feItemsControl.Items)
|
||||
{
|
||||
Selector.SetIsSelected(item, false);
|
||||
}
|
||||
selectedControl = null;
|
||||
return;
|
||||
}
|
||||
foreach (var control in feItemsControl.Items.OfType<FrameworkElement>())
|
||||
{
|
||||
if (ProcessControl(control, clickedElement, ref selectedControl))
|
||||
{
|
||||
if (selectedControl is ContentControl cc && cc.Content is ButtonBase)
|
||||
{
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private static bool ProcessControl(FrameworkElement control, FrameworkElement clickedElement, ref FrameworkElement selectedControl)
|
||||
{
|
||||
if (control == clickedElement && control != selectedControl)
|
||||
{
|
||||
if (selectedControl != null)
|
||||
{
|
||||
Selector.SetIsSelected(selectedControl, false);
|
||||
}
|
||||
Selector.SetIsSelected(control, true);
|
||||
selectedControl = control;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
75
BrightSharp.NET/BrightSharp.NET/Diagrams/Thumbs/MoveThumb.cs
Normal file
75
BrightSharp.NET/BrightSharp.NET/Diagrams/Thumbs/MoveThumb.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace BrightSharp.Diagrams
|
||||
{
|
||||
[ToolboxItem(false)]
|
||||
public class MoveThumb : Thumb
|
||||
{
|
||||
private RotateTransform rotateTransform;
|
||||
private FrameworkElement designerItem;
|
||||
private static int? zIndex = null;
|
||||
|
||||
public MoveThumb()
|
||||
{
|
||||
DragStarted += MoveThumb_DragStarted;
|
||||
DragDelta += MoveThumb_DragDelta;
|
||||
DragCompleted += MoveThumb_DragCompleted;
|
||||
}
|
||||
|
||||
private void MoveThumb_DragCompleted(object sender, DragCompletedEventArgs e)
|
||||
{
|
||||
//TODO Need think about ZIndex changes
|
||||
}
|
||||
|
||||
private void MoveThumb_DragStarted(object sender, DragStartedEventArgs e)
|
||||
{
|
||||
designerItem = DataContext as FrameworkElement;
|
||||
|
||||
if (designerItem != null)
|
||||
{
|
||||
rotateTransform = designerItem.RenderTransform as RotateTransform;
|
||||
if (designerItem.GetBindingExpression(Panel.ZIndexProperty) == null)
|
||||
{
|
||||
zIndex = Math.Max(zIndex ?? 0, Panel.GetZIndex(designerItem));
|
||||
Panel.SetZIndex(designerItem, zIndex.Value + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void MoveThumb_DragDelta(object sender, DragDeltaEventArgs e)
|
||||
{
|
||||
if (designerItem != null)
|
||||
{
|
||||
Point dragDelta = new Point(e.HorizontalChange, e.VerticalChange);
|
||||
|
||||
double gridSize = 0;
|
||||
|
||||
var zoomControl = designerItem.Parent as ZoomControl;
|
||||
if (zoomControl != null) gridSize = zoomControl.GridSize;
|
||||
|
||||
if (rotateTransform != null)
|
||||
{
|
||||
dragDelta = rotateTransform.Transform(dragDelta);
|
||||
}
|
||||
if (double.IsNaN(Canvas.GetLeft(designerItem))) Canvas.SetLeft(designerItem, 0);
|
||||
if (double.IsNaN(Canvas.GetTop(designerItem))) Canvas.SetTop(designerItem, 0);
|
||||
|
||||
var newLeft = Canvas.GetLeft(designerItem) + dragDelta.X;
|
||||
var newTop = Canvas.GetTop(designerItem) + dragDelta.Y;
|
||||
if (gridSize > 0)
|
||||
{
|
||||
newLeft = Math.Truncate(newLeft / gridSize) * gridSize;
|
||||
newTop = Math.Truncate(newTop / gridSize) * gridSize;
|
||||
}
|
||||
Canvas.SetLeft(designerItem, newLeft);
|
||||
Canvas.SetTop(designerItem, newTop);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
160
BrightSharp.NET/BrightSharp.NET/Diagrams/Thumbs/ResizeThumb.cs
Normal file
160
BrightSharp.NET/BrightSharp.NET/Diagrams/Thumbs/ResizeThumb.cs
Normal file
@@ -0,0 +1,160 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Input;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace BrightSharp.Diagrams
|
||||
{
|
||||
[ToolboxItem(false)]
|
||||
public class ResizeThumb : Thumb
|
||||
{
|
||||
private RotateTransform rotateTransform;
|
||||
private double angle;
|
||||
private Adorner adorner;
|
||||
private Point transformOrigin;
|
||||
private FrameworkElement designerItem;
|
||||
private FrameworkElement canvas;
|
||||
|
||||
public ResizeThumb()
|
||||
{
|
||||
DragStarted += new DragStartedEventHandler(ResizeThumb_DragStarted);
|
||||
DragDelta += new DragDeltaEventHandler(ResizeThumb_DragDelta);
|
||||
DragCompleted += new DragCompletedEventHandler(ResizeThumb_DragCompleted);
|
||||
MouseRightButtonDown += new MouseButtonEventHandler(ResizeThumb_MouseRightButtonDown);
|
||||
}
|
||||
|
||||
private void ResizeThumb_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
designerItem = designerItem ?? DataContext as FrameworkElement;
|
||||
|
||||
if (VerticalAlignment == VerticalAlignment.Top || VerticalAlignment == VerticalAlignment.Bottom)
|
||||
{
|
||||
designerItem.Height = double.NaN;
|
||||
}
|
||||
if (HorizontalAlignment == HorizontalAlignment.Left || HorizontalAlignment == HorizontalAlignment.Right)
|
||||
{
|
||||
designerItem.Width = double.NaN;
|
||||
}
|
||||
}
|
||||
|
||||
private void ResizeThumb_DragStarted(object sender, DragStartedEventArgs e)
|
||||
{
|
||||
designerItem = DataContext as ContentControl;
|
||||
|
||||
if (designerItem != null)
|
||||
{
|
||||
canvas = VisualTreeHelper.GetParent(designerItem) as FrameworkElement;
|
||||
|
||||
if (canvas != null)
|
||||
{
|
||||
transformOrigin = designerItem.RenderTransformOrigin;
|
||||
|
||||
rotateTransform = designerItem.RenderTransform as RotateTransform;
|
||||
if (rotateTransform != null)
|
||||
{
|
||||
angle = rotateTransform.Angle * Math.PI / 180.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
angle = 0.0d;
|
||||
}
|
||||
|
||||
AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(canvas);
|
||||
if (adornerLayer != null)
|
||||
{
|
||||
adorner = new SizeAdorner(designerItem);
|
||||
adornerLayer.Add(adorner);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ResizeThumb_DragDelta(object sender, DragDeltaEventArgs e)
|
||||
{
|
||||
if (designerItem != null)
|
||||
{
|
||||
double deltaVertical, deltaHorizontal;
|
||||
if (double.IsNaN(Canvas.GetTop(designerItem))) Canvas.SetTop(designerItem, 0);
|
||||
if (double.IsNaN(Canvas.GetLeft(designerItem))) Canvas.SetLeft(designerItem, 0);
|
||||
if ((VerticalAlignment == VerticalAlignment.Top || VerticalAlignment == VerticalAlignment.Bottom) && double.IsNaN(designerItem.Height)) designerItem.Height = designerItem.ActualHeight;
|
||||
if ((HorizontalAlignment == HorizontalAlignment.Left || HorizontalAlignment == HorizontalAlignment.Right) && double.IsNaN(designerItem.Width)) designerItem.Width = designerItem.ActualWidth;
|
||||
|
||||
var zoomControl = designerItem.Parent as dynamic;
|
||||
double.TryParse(zoomControl.Tag as string, out var gridSize);
|
||||
|
||||
var verticalChange = e.VerticalChange;
|
||||
var horizontalChange = e.HorizontalChange;
|
||||
|
||||
if (gridSize > 0)
|
||||
{
|
||||
verticalChange = Math.Truncate(verticalChange / gridSize) * gridSize;
|
||||
horizontalChange = Math.Truncate(horizontalChange / gridSize) * gridSize;
|
||||
}
|
||||
if (verticalChange != 0)
|
||||
{
|
||||
switch (VerticalAlignment)
|
||||
{
|
||||
case System.Windows.VerticalAlignment.Bottom:
|
||||
deltaVertical = Math.Min(-verticalChange, designerItem.ActualHeight - designerItem.MinHeight);
|
||||
deltaVertical = Math.Max(deltaVertical, designerItem.ActualHeight - designerItem.MaxHeight);
|
||||
Canvas.SetTop(designerItem, Canvas.GetTop(designerItem) + (transformOrigin.Y * deltaVertical * (1 - Math.Cos(-angle))));
|
||||
Canvas.SetLeft(designerItem, Canvas.GetLeft(designerItem) - deltaVertical * transformOrigin.Y * Math.Sin(-angle));
|
||||
designerItem.Height -= deltaVertical;
|
||||
break;
|
||||
case System.Windows.VerticalAlignment.Top:
|
||||
deltaVertical = Math.Min(verticalChange, designerItem.ActualHeight - designerItem.MinHeight);
|
||||
deltaVertical = Math.Max(deltaVertical, designerItem.ActualHeight - designerItem.MaxHeight);
|
||||
Canvas.SetTop(designerItem, Canvas.GetTop(designerItem) + deltaVertical * Math.Cos(-angle) + (transformOrigin.Y * deltaVertical * (1 - Math.Cos(-angle))));
|
||||
Canvas.SetLeft(designerItem, Canvas.GetLeft(designerItem) + deltaVertical * Math.Sin(-angle) - (transformOrigin.Y * deltaVertical * Math.Sin(-angle)));
|
||||
designerItem.Height -= deltaVertical;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (horizontalChange != 0)
|
||||
{
|
||||
switch (HorizontalAlignment)
|
||||
{
|
||||
case System.Windows.HorizontalAlignment.Left:
|
||||
deltaHorizontal = Math.Min(horizontalChange, designerItem.ActualWidth - designerItem.MinWidth);
|
||||
deltaHorizontal = Math.Max(deltaHorizontal, designerItem.ActualWidth - designerItem.MaxWidth);
|
||||
Canvas.SetTop(designerItem, Canvas.GetTop(designerItem) + deltaHorizontal * Math.Sin(angle) - transformOrigin.X * deltaHorizontal * Math.Sin(angle));
|
||||
Canvas.SetLeft(designerItem, Canvas.GetLeft(designerItem) + deltaHorizontal * Math.Cos(angle) + (transformOrigin.X * deltaHorizontal * (1 - Math.Cos(angle))));
|
||||
designerItem.Width -= deltaHorizontal;
|
||||
break;
|
||||
case System.Windows.HorizontalAlignment.Right:
|
||||
deltaHorizontal = Math.Min(-horizontalChange, designerItem.ActualWidth - designerItem.MinWidth);
|
||||
deltaHorizontal = Math.Max(deltaHorizontal, designerItem.ActualWidth - designerItem.MaxWidth);
|
||||
Canvas.SetTop(designerItem, Canvas.GetTop(designerItem) - transformOrigin.X * deltaHorizontal * Math.Sin(angle));
|
||||
Canvas.SetLeft(designerItem, Canvas.GetLeft(designerItem) + (deltaHorizontal * transformOrigin.X * (1 - Math.Cos(angle))));
|
||||
designerItem.Width -= deltaHorizontal;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void ResizeThumb_DragCompleted(object sender, DragCompletedEventArgs e)
|
||||
{
|
||||
if (adorner != null)
|
||||
{
|
||||
AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(canvas);
|
||||
if (adornerLayer != null)
|
||||
{
|
||||
adornerLayer.Remove(adorner);
|
||||
}
|
||||
|
||||
adorner = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace BrightSharp.Diagrams
|
||||
{
|
||||
[ToolboxItem(false)]
|
||||
public class RotateThumb : Thumb
|
||||
{
|
||||
private double initialAngle;
|
||||
private RotateTransform rotateTransform;
|
||||
private Vector startVector;
|
||||
private Point centerPoint;
|
||||
private ContentControl designerItem;
|
||||
private Canvas canvas;
|
||||
|
||||
public RotateThumb()
|
||||
{
|
||||
DragDelta += new DragDeltaEventHandler(RotateThumb_DragDelta);
|
||||
DragStarted += new DragStartedEventHandler(RotateThumb_DragStarted);
|
||||
MouseRightButtonDown += RotateThumb_MouseLeftButtonDown;
|
||||
}
|
||||
|
||||
private void RotateThumb_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (e.RightButton == MouseButtonState.Pressed)
|
||||
{
|
||||
rotateTransform = designerItem.RenderTransform as RotateTransform;
|
||||
if (rotateTransform != null)
|
||||
{
|
||||
rotateTransform.Angle = 0;
|
||||
designerItem.InvalidateMeasure();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void RotateThumb_DragStarted(object sender, DragStartedEventArgs e)
|
||||
{
|
||||
designerItem = DataContext as ContentControl;
|
||||
|
||||
if (designerItem != null)
|
||||
{
|
||||
canvas = VisualTreeHelper.GetParent(designerItem) as Canvas;
|
||||
|
||||
if (canvas != null)
|
||||
{
|
||||
centerPoint = designerItem.TranslatePoint(
|
||||
new Point(designerItem.ActualWidth * designerItem.RenderTransformOrigin.X,
|
||||
designerItem.ActualHeight * designerItem.RenderTransformOrigin.Y),
|
||||
canvas);
|
||||
|
||||
Point startPoint = Mouse.GetPosition(canvas);
|
||||
startVector = Point.Subtract(startPoint, centerPoint);
|
||||
|
||||
rotateTransform = designerItem.RenderTransform as RotateTransform;
|
||||
if (rotateTransform == null)
|
||||
{
|
||||
designerItem.RenderTransform = new RotateTransform(0);
|
||||
initialAngle = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
initialAngle = rotateTransform.Angle;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void RotateThumb_DragDelta(object sender, DragDeltaEventArgs e)
|
||||
{
|
||||
if (designerItem != null && canvas != null)
|
||||
{
|
||||
Point currentPoint = Mouse.GetPosition(canvas);
|
||||
Vector deltaVector = Point.Subtract(currentPoint, centerPoint);
|
||||
|
||||
double angle = Vector.AngleBetween(startVector, deltaVector);
|
||||
|
||||
RotateTransform rotateTransform = designerItem.RenderTransform as RotateTransform;
|
||||
rotateTransform.Angle = initialAngle + Math.Round(angle, 0);
|
||||
designerItem.InvalidateMeasure();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
132
BrightSharp.NET/BrightSharp.NET/Diagrams/VisualExtensions.cs
Normal file
132
BrightSharp.NET/BrightSharp.NET/Diagrams/VisualExtensions.cs
Normal file
@@ -0,0 +1,132 @@
|
||||
using BrightSharp.Extensions;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Animation;
|
||||
|
||||
namespace BrightSharp.Diagrams
|
||||
{
|
||||
/// <summary>
|
||||
/// If starts with a(A) then use animation,
|
||||
/// $FromZoom-$ToZoom pattern
|
||||
/// </summary>
|
||||
public class VisualExtensions : DependencyObject
|
||||
{
|
||||
#region LevelOfDetails Attached Property
|
||||
|
||||
public static readonly DependencyProperty LODZoomProperty =
|
||||
DependencyProperty.RegisterAttached("LODZoom",
|
||||
typeof(string),
|
||||
typeof(VisualExtensions),
|
||||
new UIPropertyMetadata(null, OnChangeLODZoomProperty));
|
||||
|
||||
public static void SetLODZoom(UIElement element, string o)
|
||||
{
|
||||
element.SetValue(LODZoomProperty, o);
|
||||
}
|
||||
|
||||
public static string GetLODZoom(UIElement element)
|
||||
{
|
||||
return (string)element.GetValue(LODZoomProperty);
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static bool GetCanRotate(DependencyObject obj) {
|
||||
return (bool)obj.GetValue(CanRotateProperty);
|
||||
}
|
||||
|
||||
public static void SetCanRotate(DependencyObject obj, bool value) {
|
||||
obj.SetValue(CanRotateProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty CanRotateProperty =
|
||||
DependencyProperty.RegisterAttached("CanRotate", typeof(bool), typeof(VisualExtensions), new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.Inherits));
|
||||
|
||||
private static void OnChangeLODZoomProperty(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var element = d as FrameworkElement;
|
||||
if (element == null) return;
|
||||
|
||||
var window = Window.GetWindow(element);
|
||||
if (window == null) return;
|
||||
|
||||
if (e.NewValue != e.OldValue)
|
||||
{
|
||||
var zoomControl = element.FindAncestor<ZoomControl>();
|
||||
if (zoomControl == null) return;
|
||||
|
||||
var zoomChangedHandler = new RoutedEventHandler((sender, args) =>
|
||||
{
|
||||
try {
|
||||
ChangeVisibility(args, element, window);
|
||||
}
|
||||
catch (Exception) {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if (string.IsNullOrWhiteSpace((string)e.NewValue))
|
||||
{
|
||||
element.Opacity = 1;
|
||||
zoomControl.ZoomChanged -= zoomChangedHandler;
|
||||
zoomControl.Loaded -= zoomChangedHandler;
|
||||
}
|
||||
else
|
||||
{
|
||||
zoomControl.ZoomChanged += zoomChangedHandler;
|
||||
zoomControl.Loaded += zoomChangedHandler;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void ChangeVisibility(RoutedEventArgs args, FrameworkElement element, Window window) {
|
||||
var lodInfo = new LodInfo(GetLODZoom(element));
|
||||
|
||||
var transform = element.TransformToVisual(window) as MatrixTransform;
|
||||
var scaleX = transform.Matrix.M11;
|
||||
|
||||
var newOpacity = (scaleX >= lodInfo.StartRange && scaleX <= lodInfo.EndRange) ? 1 : 0;
|
||||
|
||||
if (lodInfo.UseAnimation && args.RoutedEvent != FrameworkElement.LoadedEvent) {
|
||||
element.Visibility = Visibility.Visible;
|
||||
var animation = new DoubleAnimation(newOpacity, TimeSpan.FromSeconds(.5));
|
||||
element.BeginAnimation(UIElement.OpacityProperty, animation);
|
||||
}
|
||||
else {
|
||||
element.Visibility = newOpacity == 1 ? Visibility.Visible : Visibility.Hidden;
|
||||
element.Opacity = newOpacity;
|
||||
}
|
||||
}
|
||||
|
||||
sealed class LodInfo
|
||||
{
|
||||
public LodInfo(string lod)
|
||||
{
|
||||
lod = lod.TrimStart();
|
||||
UseAnimation = lod.StartsWith("a", true, CultureInfo.InvariantCulture);
|
||||
lod = lod.TrimStart('a', 'A').Trim();
|
||||
|
||||
double rangeStart = 0;
|
||||
double rangeEnd = double.PositiveInfinity;
|
||||
var vals = lod.Split('-');
|
||||
|
||||
double.TryParse(vals[0], NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out rangeStart);
|
||||
|
||||
if (vals.Length > 1)
|
||||
{
|
||||
if (!double.TryParse(vals[1], NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out rangeEnd))
|
||||
{
|
||||
rangeEnd = double.PositiveInfinity;
|
||||
}
|
||||
}
|
||||
EndRange = rangeEnd;
|
||||
StartRange = rangeStart;
|
||||
}
|
||||
public double StartRange { get; set; }
|
||||
public double EndRange { get; set; }
|
||||
public bool UseAnimation { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
228
BrightSharp.NET/BrightSharp.NET/Diagrams/ZoomControl.cs
Normal file
228
BrightSharp.NET/BrightSharp.NET/Diagrams/ZoomControl.cs
Normal file
@@ -0,0 +1,228 @@
|
||||
using BrightSharp.Extensions;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media.Animation;
|
||||
|
||||
namespace BrightSharp.Diagrams
|
||||
{
|
||||
|
||||
public partial class ZoomControl : ItemsControl
|
||||
{
|
||||
public ZoomControl()
|
||||
{
|
||||
Loaded += ZoomControl_Loaded;
|
||||
|
||||
}
|
||||
|
||||
private void ZoomControl_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
SelectionBehavior.Attach(this);
|
||||
}
|
||||
|
||||
public ContentControl SelectedControl
|
||||
{
|
||||
get { return (ContentControl)GetValue(SelectedControlProperty); }
|
||||
set { SetValue(SelectedControlProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty SelectedControlProperty =
|
||||
DependencyProperty.Register("SelectedControl", typeof(ContentControl), typeof(ZoomControl), new PropertyMetadata(null));
|
||||
|
||||
protected override void OnPreviewMouseDown(MouseButtonEventArgs e)
|
||||
{
|
||||
base.OnPreviewMouseDown(e);
|
||||
|
||||
if (e.MiddleButton == MouseButtonState.Pressed)
|
||||
{
|
||||
_panPoint = e.GetPosition(this);
|
||||
}
|
||||
}
|
||||
|
||||
private Point? _panPoint;
|
||||
|
||||
#region Props
|
||||
|
||||
public double TranslateX
|
||||
{
|
||||
get { return (double)GetValue(TranslateXProperty); }
|
||||
set { SetValue(TranslateXProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty TranslateXProperty =
|
||||
DependencyProperty.Register("TranslateX", typeof(double), typeof(ZoomControl), new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsArrange, TranslateChangedHandler));
|
||||
|
||||
|
||||
|
||||
public double TranslateY
|
||||
{
|
||||
get { return (double)GetValue(TranslateYProperty); }
|
||||
set { SetValue(TranslateYProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty TranslateYProperty =
|
||||
DependencyProperty.Register("TranslateY", typeof(double), typeof(ZoomControl), new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsArrange, TranslateChangedHandler));
|
||||
|
||||
|
||||
|
||||
public double GridSize
|
||||
{
|
||||
get { return (double)GetValue(GridSizeProperty); }
|
||||
set { SetValue(GridSizeProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty GridSizeProperty =
|
||||
DependencyProperty.Register("GridSize", typeof(double), typeof(ZoomControl), new PropertyMetadata(0.0));
|
||||
|
||||
public double RenderZoom
|
||||
{
|
||||
get { return (double)GetValue(RenderZoomProperty); }
|
||||
set { SetValue(RenderZoomProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty RenderZoomProperty =
|
||||
DependencyProperty.Register("RenderZoom", typeof(double), typeof(ZoomControl), new FrameworkPropertyMetadata(1.0, FrameworkPropertyMetadataOptions.AffectsArrange, ZoomChangedHandler));
|
||||
|
||||
private static void ZoomChangedHandler(DependencyObject d, DependencyPropertyChangedEventArgs baseValue)
|
||||
{
|
||||
ZoomControl zc = (ZoomControl)d;
|
||||
}
|
||||
private static void TranslateChangedHandler(DependencyObject d, DependencyPropertyChangedEventArgs baseValue)
|
||||
{
|
||||
ZoomControl zc = (ZoomControl)d;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private static readonly RoutedEvent ZoomChangedEvent = EventManager.RegisterRoutedEvent("ZoomChanged", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(ZoomControl));
|
||||
|
||||
public event RoutedEventHandler ZoomChanged
|
||||
{
|
||||
add { AddHandler(ZoomChangedEvent, value); }
|
||||
remove { RemoveHandler(ZoomChangedEvent, value); }
|
||||
}
|
||||
|
||||
private void RaiseZoomChangedEvent()
|
||||
{
|
||||
var newEventArgs = new RoutedEventArgs(ZoomChangedEvent);
|
||||
RaiseEvent(newEventArgs);
|
||||
}
|
||||
|
||||
static ZoomControl()
|
||||
{
|
||||
DefaultStyleKeyProperty.OverrideMetadata(typeof(ZoomControl), new FrameworkPropertyMetadata(typeof(ZoomControl)));
|
||||
}
|
||||
|
||||
protected override void OnPreviewMouseWheel(MouseWheelEventArgs e)
|
||||
{
|
||||
if (CheckMouseOverControlWheelHandle(_panPoint.HasValue))
|
||||
return;
|
||||
|
||||
var point = e.GetPosition(this);
|
||||
|
||||
|
||||
var oldValue = RenderZoom;
|
||||
const double zoomPower = 1.25;
|
||||
var newValue = RenderZoom * (e.Delta > 0 ? zoomPower : 1 / zoomPower);
|
||||
if (UseAnimation)
|
||||
{
|
||||
DoubleAnimation anim = new DoubleAnimation(newValue, TimeSpan.FromSeconds(.3));
|
||||
anim.EasingFunction = new SineEase() { EasingMode = EasingMode.EaseInOut };
|
||||
BeginAnimation(ZoomControl.RenderZoomProperty, anim);
|
||||
}
|
||||
else
|
||||
{
|
||||
DoubleAnimation anim = new DoubleAnimation(newValue, TimeSpan.FromSeconds(0));
|
||||
anim.EasingFunction = new SineEase() { EasingMode = EasingMode.EaseInOut };
|
||||
BeginAnimation(ZoomControl.RenderZoomProperty, anim);
|
||||
}
|
||||
|
||||
RaiseZoomChangedEvent();
|
||||
|
||||
var translateXTo = CoercePanTranslate(TranslateX, point.X, oldValue, newValue);
|
||||
var translateYTo = CoercePanTranslate(TranslateY, point.Y, oldValue, newValue);
|
||||
if (UseAnimation)
|
||||
{
|
||||
DoubleAnimation anim = new DoubleAnimation(translateXTo, TimeSpan.FromSeconds(.3));
|
||||
anim.EasingFunction = new SineEase() { EasingMode = EasingMode.EaseInOut };
|
||||
BeginAnimation(ZoomControl.TranslateXProperty, anim);
|
||||
|
||||
anim = new DoubleAnimation(translateYTo, TimeSpan.FromSeconds(.3));
|
||||
anim.EasingFunction = new SineEase() { EasingMode = EasingMode.EaseInOut };
|
||||
BeginAnimation(ZoomControl.TranslateYProperty, anim);
|
||||
}
|
||||
else
|
||||
{
|
||||
DoubleAnimation anim = new DoubleAnimation(translateXTo, TimeSpan.FromSeconds(0));
|
||||
anim.EasingFunction = new SineEase() { EasingMode = EasingMode.EaseInOut };
|
||||
BeginAnimation(ZoomControl.TranslateXProperty, anim);
|
||||
|
||||
anim = new DoubleAnimation(translateYTo, TimeSpan.FromSeconds(0));
|
||||
anim.EasingFunction = new SineEase() { EasingMode = EasingMode.EaseInOut };
|
||||
BeginAnimation(ZoomControl.TranslateYProperty, anim);
|
||||
}
|
||||
|
||||
e.Handled = true;
|
||||
|
||||
base.OnPreviewMouseWheel(e);
|
||||
}
|
||||
public bool UseAnimation { get; set; }
|
||||
private static bool CheckMouseOverControlWheelHandle(bool checkFlowDoc = false)
|
||||
{
|
||||
if (Keyboard.IsKeyDown(Key.LeftCtrl)) return false;
|
||||
var element = Mouse.DirectlyOver as DependencyObject;
|
||||
if (element is ScrollViewer) return true;
|
||||
|
||||
var scrollViewer = element.FindAncestor<ScrollViewer>();
|
||||
if (scrollViewer != null)
|
||||
{
|
||||
return scrollViewer.ComputedVerticalScrollBarVisibility == Visibility.Visible
|
||||
|| scrollViewer.ComputedHorizontalScrollBarVisibility == Visibility.Visible;
|
||||
}
|
||||
if (checkFlowDoc)
|
||||
{
|
||||
var flowDocument = element.FindAncestor<FlowDocument>();
|
||||
if (flowDocument != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static double CoercePanTranslate(double oldTranslate, double mousePos, double oldZoom, double newZoom)
|
||||
{
|
||||
return Math.Round(oldTranslate + (oldTranslate - mousePos) * (newZoom - oldZoom) / oldZoom);
|
||||
}
|
||||
|
||||
protected override void OnMouseUp(MouseButtonEventArgs e)
|
||||
{
|
||||
base.OnMouseUp(e);
|
||||
|
||||
if (e.MiddleButton == MouseButtonState.Released)
|
||||
{
|
||||
_panPoint = null;
|
||||
ReleaseMouseCapture();
|
||||
}
|
||||
}
|
||||
protected override void OnPreviewMouseMove(MouseEventArgs e)
|
||||
{
|
||||
base.OnPreviewMouseMove(e);
|
||||
if (e.MiddleButton == MouseButtonState.Pressed && _panPoint.HasValue)
|
||||
{
|
||||
//PAN MODE
|
||||
var vector = e.GetPosition(this) - _panPoint.Value;
|
||||
_panPoint = _panPoint + vector;
|
||||
CaptureMouse();
|
||||
TranslateX += vector.X;
|
||||
TranslateY += vector.Y;
|
||||
BeginAnimation(TranslateXProperty, null);
|
||||
BeginAnimation(TranslateYProperty, null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
using BrightSharp.Behaviors;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace BrightSharp.Extensions
|
||||
{
|
||||
public static class MarkupExtensionProperties
|
||||
{
|
||||
public static CornerRadius GetCornerRadius(DependencyObject obj)
|
||||
{
|
||||
return (CornerRadius)obj.GetValue(CornerRadiusProperty);
|
||||
}
|
||||
public static void SetCornerRadius(DependencyObject obj, CornerRadius value)
|
||||
{
|
||||
obj.SetValue(CornerRadiusProperty, value);
|
||||
}
|
||||
public static object GetHeader(DependencyObject obj)
|
||||
{
|
||||
return obj.GetValue(HeaderProperty);
|
||||
}
|
||||
public static void SetHeader(DependencyObject obj, object value)
|
||||
{
|
||||
obj.SetValue(HeaderProperty, value);
|
||||
}
|
||||
public static object GetLeadingElement(DependencyObject obj)
|
||||
{
|
||||
return obj.GetValue(CornerRadiusProperty);
|
||||
}
|
||||
public static void SetLeadingElement(DependencyObject obj, object value)
|
||||
{
|
||||
obj.SetValue(CornerRadiusProperty, value);
|
||||
}
|
||||
public static object GetTrailingElement(DependencyObject obj)
|
||||
{
|
||||
return obj.GetValue(CornerRadiusProperty);
|
||||
}
|
||||
public static void SetTrailingElement(DependencyObject obj, object value)
|
||||
{
|
||||
obj.SetValue(CornerRadiusProperty, value);
|
||||
}
|
||||
public static object GetIcon(DependencyObject obj)
|
||||
{
|
||||
return obj.GetValue(IconProperty);
|
||||
}
|
||||
public static void SetIcon(DependencyObject obj, object value)
|
||||
{
|
||||
obj.SetValue(IconProperty, value);
|
||||
}
|
||||
public static void SetHeaderHeight(DependencyObject obj, double value)
|
||||
{
|
||||
obj.SetValue(HeaderHeightProperty, value);
|
||||
}
|
||||
public static double GetHeaderHeight(DependencyObject obj)
|
||||
{
|
||||
return (double)obj.GetValue(HeaderHeightProperty);
|
||||
}
|
||||
|
||||
public static void SetHeaderVerticalAlignment(DependencyObject obj, VerticalAlignment value)
|
||||
{
|
||||
obj.SetValue(HeaderVerticalAlignmentProperty, value);
|
||||
}
|
||||
public static VerticalAlignment GetHeaderVerticalAlignment(DependencyObject obj)
|
||||
{
|
||||
return (VerticalAlignment)obj.GetValue(HeaderVerticalAlignmentProperty);
|
||||
}
|
||||
public static void SetHeaderHorizontalAlignment(DependencyObject obj, HorizontalAlignment value)
|
||||
{
|
||||
obj.SetValue(HeaderHorizontalAlignmentProperty, value);
|
||||
}
|
||||
public static HorizontalAlignment GetHeaderHorizontalAlignment(DependencyObject obj)
|
||||
{
|
||||
return (HorizontalAlignment)obj.GetValue(HeaderHorizontalAlignmentProperty);
|
||||
}
|
||||
public static void SetSpecialHeight(DependencyObject obj, double value)
|
||||
{
|
||||
obj.SetValue(SpecialHeightProperty, value);
|
||||
}
|
||||
public static double GetSpecialHeight(DependencyObject obj)
|
||||
{
|
||||
return (double)obj.GetValue(SpecialHeightProperty);
|
||||
}
|
||||
public static void SetSpecialWidth(DependencyObject obj, double value)
|
||||
{
|
||||
obj.SetValue(SpecialWidthProperty, value);
|
||||
}
|
||||
public static double GetSpecialWidth(DependencyObject obj)
|
||||
{
|
||||
return (double)obj.GetValue(SpecialWidthProperty);
|
||||
}
|
||||
public static Dock GetDocking(DependencyObject obj)
|
||||
{
|
||||
return (Dock)obj.GetValue(DockingProperty);
|
||||
}
|
||||
public static void SetDocking(DependencyObject obj, Dock value)
|
||||
{
|
||||
obj.SetValue(DockingProperty, value);
|
||||
}
|
||||
public static Thickness GetHeaderPadding(DependencyObject obj)
|
||||
{
|
||||
return (Thickness)obj.GetValue(HeaderPaddingProperty);
|
||||
}
|
||||
public static void SetHeaderPadding(DependencyObject obj, Thickness value)
|
||||
{
|
||||
obj.SetValue(HeaderPaddingProperty, value);
|
||||
}
|
||||
public static bool GetIsDragHelperVisible(DependencyObject obj)
|
||||
{
|
||||
return (bool)obj.GetValue(IsDragHelperVisibleProperty);
|
||||
}
|
||||
public static void SetIsDragHelperVisible(DependencyObject obj, bool value)
|
||||
{
|
||||
obj.SetValue(IsDragHelperVisibleProperty, value);
|
||||
}
|
||||
public static Brush GetSpecialBrush(DependencyObject obj)
|
||||
{
|
||||
return (Brush)obj.GetValue(SpecialBrushProperty);
|
||||
}
|
||||
public static void SetSpecialBrush(DependencyObject obj, Brush value)
|
||||
{
|
||||
obj.SetValue(SpecialBrushProperty, value);
|
||||
}
|
||||
|
||||
public static bool GetUseMinMaxSizeBehavior(Window obj)
|
||||
{
|
||||
return (bool)obj.GetValue(UseMinMaxSizeBehaviorProperty);
|
||||
}
|
||||
|
||||
public static void SetUseMinMaxSizeBehavior(Window obj, bool value)
|
||||
{
|
||||
obj.SetValue(UseMinMaxSizeBehaviorProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty SpecialBrushProperty = DependencyProperty.RegisterAttached("SpecialBrush", typeof(Brush), typeof(MarkupExtensionProperties), new PropertyMetadata(null));
|
||||
public static readonly DependencyProperty IsDragHelperVisibleProperty = DependencyProperty.RegisterAttached("IsDragHelperVisible", typeof(bool), typeof(MarkupExtensionProperties), new FrameworkPropertyMetadata(true));
|
||||
public static readonly DependencyProperty HeaderPaddingProperty = DependencyProperty.RegisterAttached("HeaderPadding", typeof(Thickness), typeof(MarkupExtensionProperties), new PropertyMetadata(null));
|
||||
public static readonly DependencyProperty CornerRadiusProperty = DependencyProperty.RegisterAttached("CornerRadius", typeof(CornerRadius), typeof(MarkupExtensionProperties), new PropertyMetadata(null));
|
||||
public static readonly DependencyProperty LeadingElementProperty = DependencyProperty.RegisterAttached("LeadingElement", typeof(object), typeof(MarkupExtensionProperties), new PropertyMetadata(null));
|
||||
public static readonly DependencyProperty TrailingElementProperty = DependencyProperty.RegisterAttached("TrailingElement", typeof(object), typeof(MarkupExtensionProperties), new PropertyMetadata(null));
|
||||
public static readonly DependencyProperty HeaderProperty = DependencyProperty.RegisterAttached("Header", typeof(object), typeof(MarkupExtensionProperties), new FrameworkPropertyMetadata(null));
|
||||
public static readonly DependencyProperty DockingProperty = DependencyProperty.RegisterAttached("Docking", typeof(Dock), typeof(MarkupExtensionProperties), new PropertyMetadata(null));
|
||||
public static readonly DependencyProperty IconProperty = DependencyProperty.RegisterAttached("Icon", typeof(object), typeof(MarkupExtensionProperties), new PropertyMetadata(null));
|
||||
public static readonly DependencyProperty HeaderHeightProperty = DependencyProperty.RegisterAttached("HeaderHeight", typeof(double), typeof(MarkupExtensionProperties), new PropertyMetadata(null));
|
||||
public static readonly DependencyProperty HeaderVerticalAlignmentProperty = DependencyProperty.RegisterAttached("HeaderVerticalAlignment", typeof(VerticalAlignment), typeof(MarkupExtensionProperties), new PropertyMetadata(VerticalAlignment.Center));
|
||||
public static readonly DependencyProperty HeaderHorizontalAlignmentProperty = DependencyProperty.RegisterAttached("HeaderHorizontalAlignment", typeof(HorizontalAlignment), typeof(MarkupExtensionProperties), new PropertyMetadata(HorizontalAlignment.Left));
|
||||
public static readonly DependencyProperty SpecialHeightProperty = DependencyProperty.RegisterAttached("SpecialHeight", typeof(double), typeof(MarkupExtensionProperties), new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.Inherits | FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.AffectsMeasure));
|
||||
public static readonly DependencyProperty SpecialWidthProperty = DependencyProperty.RegisterAttached("SpecialWidth", typeof(double), typeof(MarkupExtensionProperties), new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.Inherits | FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.AffectsMeasure));
|
||||
public static readonly DependencyProperty UseMinMaxSizeBehaviorProperty = DependencyProperty.RegisterAttached("UseMinMaxSizeBehavior", typeof(bool), typeof(MarkupExtensionProperties), new PropertyMetadata(false, UseMinMaxSizeBehaviorChanged));
|
||||
|
||||
|
||||
private static void UseMinMaxSizeBehaviorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var window = d as Window;
|
||||
if (window == null) return;
|
||||
if ((bool)e.NewValue)
|
||||
{
|
||||
new MinMaxSize_Logic(window).OnAttached();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Not supported yet
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
142
BrightSharp.NET/BrightSharp.NET/Extensions/WpfExtensions.cs
Normal file
142
BrightSharp.NET/BrightSharp.NET/Extensions/WpfExtensions.cs
Normal file
@@ -0,0 +1,142 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Media3D;
|
||||
|
||||
namespace BrightSharp.Extensions
|
||||
{
|
||||
public static class WpfExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns Parent item of DependencyObject
|
||||
/// </summary>
|
||||
/// <param name="obj">Child object</param>
|
||||
/// <param name="useLogicalTree">Prefer LogicalTree when need.</param>
|
||||
/// <returns>Found item</returns>
|
||||
public static DependencyObject GetParent(this DependencyObject obj, bool useLogicalTree = false)
|
||||
{
|
||||
if (!useLogicalTree && (obj is Visual || obj is Visual3D))
|
||||
return VisualTreeHelper.GetParent(obj) ?? LogicalTreeHelper.GetParent(obj);
|
||||
else
|
||||
return LogicalTreeHelper.GetParent(obj);
|
||||
}
|
||||
|
||||
public static IEnumerable<T> GetAncestors<T>(this DependencyObject obj, bool useLogicalTree = false) where T : DependencyObject
|
||||
{
|
||||
if (obj == null) yield break;
|
||||
|
||||
var x = GetParent(obj, useLogicalTree);
|
||||
|
||||
while (x != null && !(x is T))
|
||||
{
|
||||
x = GetParent(x, useLogicalTree);
|
||||
}
|
||||
if (x != null)
|
||||
yield return x as T;
|
||||
else
|
||||
yield break;
|
||||
foreach (var item in GetAncestors<T>(x, useLogicalTree))
|
||||
{
|
||||
yield return item;
|
||||
}
|
||||
}
|
||||
|
||||
public static T FindAncestor<T>(this DependencyObject obj) where T : DependencyObject
|
||||
{
|
||||
return GetAncestors<T>(obj).FirstOrDefault();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Try find ItemsPanel of ItemsControl
|
||||
/// </summary>
|
||||
/// <param name="itemsControl">Where to search</param>
|
||||
/// <returns>Panel of ItemsControl</returns>
|
||||
public static Panel GetItemsPanel(DependencyObject itemsControl)
|
||||
{
|
||||
if (itemsControl is Panel) return (Panel)itemsControl;
|
||||
ItemsPresenter itemsPresenter = FindVisualChildren<ItemsPresenter>(itemsControl).FirstOrDefault();
|
||||
if (itemsPresenter == null) return null;
|
||||
var itemsPanel = VisualTreeHelper.GetChild(itemsPresenter, 0) as Panel;
|
||||
return itemsPanel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if object is valid (no errors found in logical children)
|
||||
/// </summary>
|
||||
/// <param name="obj">Object to search</param>
|
||||
/// <returns>True if no errors found</returns>
|
||||
public static bool IsValid(this DependencyObject obj) {
|
||||
if (obj == null) return true;
|
||||
if (Validation.GetHasError(obj)) return false;
|
||||
foreach (var child in LogicalTreeHelper.GetChildren(obj).OfType<DependencyObject>()) {
|
||||
if (child == null) continue;
|
||||
if (child is UIElement ui) {
|
||||
if (!ui.IsVisible || !ui.IsEnabled) continue;
|
||||
}
|
||||
if (!IsValid(child)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Search all textboxes to update invalid with UpdateSource(). For ex. when need update validation messages.
|
||||
/// </summary>
|
||||
/// <param name="obj">Object where to search TextBoxes</param>
|
||||
public static void UpdateSources(this DependencyObject obj) {
|
||||
if (obj == null) return;
|
||||
if (Validation.GetHasError(obj)) {
|
||||
//TODO Any types?
|
||||
if (obj is TextBox tb) tb.GetBindingExpression(TextBox.TextProperty)?.UpdateSource();
|
||||
}
|
||||
foreach (var item in FindLogicalChildren<DependencyObject>(obj)) {
|
||||
UpdateSources(item);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Find all visual children of type T
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type to search</typeparam>
|
||||
/// <param name="depObj">Object where to search</param>
|
||||
/// <returns>Enumerator for items</returns>
|
||||
public static IEnumerable<T> FindVisualChildren<T>(this DependencyObject depObj) where T : DependencyObject {
|
||||
if (depObj != null && (depObj is Visual || depObj is Visual3D)) {
|
||||
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(depObj); i++) {
|
||||
DependencyObject child = VisualTreeHelper.GetChild(depObj, i);
|
||||
if (child != null && child is T) {
|
||||
yield return (T)child;
|
||||
}
|
||||
|
||||
foreach (T childOfChild in FindVisualChildren<T>(child)) {
|
||||
yield return childOfChild;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Find all logical children of type T
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type to search</typeparam>
|
||||
/// <param name="depObj">Object where to search</param>
|
||||
/// <returns>Enumerator for items</returns>
|
||||
public static IEnumerable<T> FindLogicalChildren<T>(this DependencyObject depObj) where T : DependencyObject {
|
||||
if (depObj != null) {
|
||||
foreach (object rawChild in LogicalTreeHelper.GetChildren(depObj)) {
|
||||
if (rawChild is DependencyObject child) {
|
||||
if (child is T) {
|
||||
yield return (T)child;
|
||||
}
|
||||
|
||||
foreach (T childOfChild in FindLogicalChildren<T>(child)) {
|
||||
yield return childOfChild;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
11
BrightSharp.NET/BrightSharp.NET/Interop/Constants.cs
Normal file
11
BrightSharp.NET/BrightSharp.NET/Interop/Constants.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace BrightSharp.Interop
|
||||
{
|
||||
namespace Constants
|
||||
{
|
||||
internal enum MonitorFromWindowFlags
|
||||
{
|
||||
MONITOR_DEFAULTTONEAREST = 0x00000002
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
20
BrightSharp.NET/BrightSharp.NET/Interop/NativeMethods.cs
Normal file
20
BrightSharp.NET/BrightSharp.NET/Interop/NativeMethods.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using BrightSharp.Interop.Structures;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace BrightSharp.Interop
|
||||
{
|
||||
internal static class NativeMethods
|
||||
{
|
||||
#region Monitor
|
||||
|
||||
[DllImport("user32.dll", SetLastError = true)]
|
||||
internal static extern bool GetMonitorInfo(IntPtr hMonitor, MONITORINFO lpmi);
|
||||
|
||||
[DllImport("user32.dll", SetLastError = true)]
|
||||
internal static extern IntPtr MonitorFromWindow(IntPtr handle, int flags);
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
130
BrightSharp.NET/BrightSharp.NET/Interop/Structures.cs
Normal file
130
BrightSharp.NET/BrightSharp.NET/Interop/Structures.cs
Normal file
@@ -0,0 +1,130 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace BrightSharp.Interop
|
||||
{
|
||||
namespace Structures
|
||||
{
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
|
||||
internal class MONITORINFO
|
||||
{
|
||||
public int cbSize = Marshal.SizeOf(typeof(MONITORINFO));
|
||||
|
||||
public RECT rcMonitor;
|
||||
|
||||
public RECT rcWork;
|
||||
|
||||
public int dwFlags;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 0)]
|
||||
internal struct POINT
|
||||
{
|
||||
public int x;
|
||||
public int y;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 0)]
|
||||
internal struct RECT
|
||||
{
|
||||
public int Left;
|
||||
|
||||
public int Top;
|
||||
|
||||
public int Right;
|
||||
|
||||
public int Bottom;
|
||||
|
||||
public static readonly RECT Empty;
|
||||
|
||||
public int Width
|
||||
{
|
||||
get {
|
||||
return Math.Abs(Right - Left);
|
||||
} // Abs needed for BIDI OS
|
||||
}
|
||||
|
||||
public int Height
|
||||
{
|
||||
get {
|
||||
return Bottom - Top;
|
||||
}
|
||||
}
|
||||
|
||||
public RECT(int left, int top, int right, int bottom)
|
||||
{
|
||||
Left = left;
|
||||
Top = top;
|
||||
Right = right;
|
||||
Bottom = bottom;
|
||||
}
|
||||
|
||||
public RECT(RECT rcSrc)
|
||||
{
|
||||
Left = rcSrc.Left;
|
||||
Top = rcSrc.Top;
|
||||
Right = rcSrc.Right;
|
||||
Bottom = rcSrc.Bottom;
|
||||
}
|
||||
|
||||
public bool IsEmpty
|
||||
{
|
||||
get {
|
||||
// BUGBUG : On Bidi OS (hebrew arabic) left > right
|
||||
return Left >= Right || Top >= Bottom;
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
if (this == Empty)
|
||||
{
|
||||
return "RECT {Empty}";
|
||||
}
|
||||
return "RECT { left : " + Left + " / top : " + Top + " / right : " + Right + " / bottom : " +
|
||||
Bottom + " }";
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (!(obj is RECT))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return (this == (RECT)obj);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Left.GetHashCode() + Top.GetHashCode() + Right.GetHashCode() +
|
||||
Bottom.GetHashCode();
|
||||
}
|
||||
|
||||
public static bool operator ==(RECT rect1, RECT rect2)
|
||||
{
|
||||
return (rect1.Left == rect2.Left && rect1.Top == rect2.Top && rect1.Right == rect2.Right &&
|
||||
rect1.Bottom == rect2.Bottom);
|
||||
}
|
||||
|
||||
public static bool operator !=(RECT rect1, RECT rect2)
|
||||
{
|
||||
return !(rect1 == rect2);
|
||||
}
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct MINMAXINFO
|
||||
{
|
||||
public POINT ptReserved;
|
||||
|
||||
public POINT ptMaxSize;
|
||||
|
||||
public POINT ptMaxPosition;
|
||||
|
||||
public POINT ptMinTrackSize;
|
||||
|
||||
public POINT ptMaxTrackSize;
|
||||
};
|
||||
}
|
||||
}
|
||||
26
BrightSharp.NET/BrightSharp.NET/Properties/AssemblyInfo.cs
Normal file
26
BrightSharp.NET/BrightSharp.NET/Properties/AssemblyInfo.cs
Normal 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")]
|
||||
63
BrightSharp.NET/BrightSharp.NET/Properties/Resources.Designer.cs
generated
Normal file
63
BrightSharp.NET/BrightSharp.NET/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace BrightSharp.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BrightSharp.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
117
BrightSharp.NET/BrightSharp.NET/Properties/Resources.resx
Normal file
117
BrightSharp.NET/BrightSharp.NET/Properties/Resources.resx
Normal file
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
26
BrightSharp.NET/BrightSharp.NET/Properties/Settings.Designer.cs
generated
Normal file
26
BrightSharp.NET/BrightSharp.NET/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace BrightSharp.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.7.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
@@ -0,0 +1,38 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:diag="clr-namespace:BrightSharp.Diagrams">
|
||||
|
||||
<Style TargetType="{x:Type diag:ZoomControl}">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="ClipToBounds" Value="True" />
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
<Setter Property="ItemsPanel">
|
||||
<Setter.Value>
|
||||
<ItemsPanelTemplate>
|
||||
<Canvas Background="Transparent" />
|
||||
</ItemsPanelTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type diag:ZoomControl}">
|
||||
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Margin="{TemplateBinding Padding}">
|
||||
<Grid>
|
||||
<ItemsPresenter>
|
||||
<ItemsPresenter.RenderTransform>
|
||||
<TransformGroup>
|
||||
<ScaleTransform ScaleX="{Binding RenderZoom, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
ScaleY="{Binding ScaleX, RelativeSource={RelativeSource Self}}" />
|
||||
<TranslateTransform X="{Binding TranslateX, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Y="{Binding TranslateY, RelativeSource={RelativeSource TemplatedParent}}" />
|
||||
</TransformGroup>
|
||||
</ItemsPresenter.RenderTransform>
|
||||
</ItemsPresenter>
|
||||
<Border x:Name="PART_SelectionBorder" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,43 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:s="clr-namespace:BrightSharp.Diagrams">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="SizeChrome.xaml"/>
|
||||
<ResourceDictionary Source="ResizeRotateChrome.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<ControlTemplate x:Key="MoveThumbTemplate" TargetType="{x:Type s:MoveThumb}">
|
||||
<Rectangle Fill="Transparent"/>
|
||||
</ControlTemplate>
|
||||
|
||||
<Style x:Key="DesignerItemStyle" TargetType="ContentControl">
|
||||
<Setter Property="MinHeight" Value="26"/>
|
||||
<Setter Property="MinWidth" Value="30"/>
|
||||
<Setter Property="RenderTransformOrigin" Value="0.5,0.5"/>
|
||||
<Setter Property="SnapsToDevicePixels" Value="true"/>
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
<Setter Property="MaxHeight" Value="900" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ContentControl">
|
||||
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
|
||||
<Grid DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}">
|
||||
<s:MoveThumb Focusable="False" Cursor="SizeAll" Template="{StaticResource MoveThumbTemplate}" />
|
||||
<ContentPresenter Content="{TemplateBinding ContentControl.Content}"
|
||||
Margin="{TemplateBinding Padding}"/>
|
||||
<s:DesignerItemDecorator x:Name="ItemDecorator" Focusable="False"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="Selector.IsSelected" Value="True">
|
||||
<Setter TargetName="ItemDecorator" Property="ShowDecorator" Value="True" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,114 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:s="clr-namespace:BrightSharp.Diagrams">
|
||||
<BooleanToVisibilityConverter x:Key="btvc" />
|
||||
<Style TargetType="{x:Type Shape}" x:Key="ThumbCorner">
|
||||
<Setter Property="SnapsToDevicePixels" Value="true" />
|
||||
<Setter Property="Stroke" Value="#FF0166AC" />
|
||||
<Setter Property="StrokeThickness" Value="1" />
|
||||
<Setter Property="Width" Value="7" />
|
||||
<Setter Property="Height" Value="7" />
|
||||
<Setter Property="Margin" Value="-2" />
|
||||
<Setter Property="Fill">
|
||||
<Setter.Value>
|
||||
<RadialGradientBrush Center="0.2, 0.2" GradientOrigin="0.2, 0.2" RadiusX="0.8" RadiusY="0.8">
|
||||
<GradientStop Color="White" Offset="0.0" />
|
||||
<GradientStop Color="#FF9AFF9F" Offset="0.8" />
|
||||
</RadialGradientBrush>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type s:ResizeRotateChrome}">
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type s:ResizeRotateChrome}">
|
||||
<Grid>
|
||||
<Grid Opacity="0" Margin="-3">
|
||||
<s:MoveThumb Margin="0,-20,0,0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
Height="16"
|
||||
Width="16"
|
||||
Cursor="SizeAll"
|
||||
Template="{DynamicResource MoveThumbTemplate}" />
|
||||
<s:RotateThumb Width="20"
|
||||
Height="20" Visibility="{Binding Path=DataContext.(s:VisualExtensions.CanRotate), RelativeSource={RelativeSource Self}, Converter={StaticResource btvc}}"
|
||||
Margin="0,-20,0,0"
|
||||
Cursor="Hand"
|
||||
VerticalAlignment="Top"
|
||||
HorizontalAlignment="Center"/>
|
||||
<s:ResizeThumb Height="3"
|
||||
Cursor="SizeNS"
|
||||
VerticalAlignment="Top"
|
||||
HorizontalAlignment="Stretch"/>
|
||||
<s:ResizeThumb Width="3"
|
||||
Cursor="SizeWE"
|
||||
VerticalAlignment="Stretch"
|
||||
HorizontalAlignment="Left"/>
|
||||
<s:ResizeThumb Width="3"
|
||||
Cursor="SizeWE"
|
||||
VerticalAlignment="Stretch"
|
||||
HorizontalAlignment="Right"/>
|
||||
<s:ResizeThumb Height="3"
|
||||
Cursor="SizeNS"
|
||||
VerticalAlignment="Bottom"
|
||||
HorizontalAlignment="Stretch"/>
|
||||
<s:ResizeThumb Width="7"
|
||||
Height="7"
|
||||
Margin="-2"
|
||||
Cursor="SizeNWSE"
|
||||
VerticalAlignment="Top"
|
||||
HorizontalAlignment="Left"/>
|
||||
<s:ResizeThumb Width="7"
|
||||
Height="7"
|
||||
Margin="-2"
|
||||
Cursor="SizeNESW"
|
||||
VerticalAlignment="Top"
|
||||
HorizontalAlignment="Right"/>
|
||||
<s:ResizeThumb Width="7"
|
||||
Height="7"
|
||||
Margin="-2"
|
||||
Cursor="SizeNESW"
|
||||
VerticalAlignment="Bottom"
|
||||
HorizontalAlignment="Left"/>
|
||||
<s:ResizeThumb Width="7"
|
||||
Height="7"
|
||||
Margin="-2"
|
||||
Cursor="SizeNWSE"
|
||||
VerticalAlignment="Bottom"
|
||||
HorizontalAlignment="Right"/>
|
||||
</Grid>
|
||||
<Canvas HorizontalAlignment="Right" VerticalAlignment="Top">
|
||||
<ContentControl Canvas.Left="10" Content="{Binding Tag}" />
|
||||
</Canvas>
|
||||
<Grid IsHitTestVisible="False" Opacity="1" Margin="-3">
|
||||
<Rectangle SnapsToDevicePixels="True"
|
||||
StrokeThickness="1"
|
||||
Margin="1"
|
||||
Stroke="{DynamicResource DisabledBorderBrush}" StrokeDashArray="1 0 1"/>
|
||||
<Line StrokeThickness="1" X1="0" Y1="0" X2="0" Y2="20" Visibility="{Binding Path=DataContext.(s:VisualExtensions.CanRotate), RelativeSource={RelativeSource Self}, Converter={StaticResource btvc}}"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Top"
|
||||
Margin="0,-19,0,0"
|
||||
Stroke="White" StrokeDashArray="1 2"/>
|
||||
<Path Style="{StaticResource ThumbCorner}" Stretch="Uniform" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,-20,0,0" Width="20" Height="20" Data="M 11.7927,9.92031C 12.5184,8.74318 12.6759,7.05297 12.1717,5.75967C 11.5909,4.44354 10.2501,3.37314 8.87896,3.04485C 7.39649,2.74559 5.63977,3.1934 4.48733,4.196C 3.50995,5.1756 2.91946,6.75691 3.08599,8.14841L 0.0842173,8.57665C 0.0347556,8.20576 0.00766225,7.8312 -1.64198e-005,7.45693C 0.038148,6.21681 0.383575,4.9557 0.968669,3.8699C 1.5589,2.89611 2.36362,2.03356 3.28126,1.37902C 5.28605,0.0810452 8.05891,-0.284222 10.3301,0.412526C 12.1794,1.09169 13.9099,2.53647 14.8289,4.31779C 15.3434,5.43808 15.5957,6.72245 15.5449,7.95982C 15.4307,9.19718 15.0066,10.4344 14.358,11.484L 16.0043,12.4819L 11.226,13.5191L 10.1463,8.92239L 11.7927,9.92031 Z M -1.64198e-005,-1.90735e-006 Z M 15.564,14.9728 Z "
|
||||
Fill="YellowGreen" Stroke="{DynamicResource PressedBorderBrush}"
|
||||
Visibility="{Binding Path=DataContext.(s:VisualExtensions.CanRotate), RelativeSource={RelativeSource Self}, Converter={StaticResource btvc}}"
|
||||
/>
|
||||
<Rectangle Style="{StaticResource ThumbCorner}" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
||||
<Rectangle Style="{StaticResource ThumbCorner}" HorizontalAlignment="Right" VerticalAlignment="Top"/>
|
||||
<Rectangle Style="{StaticResource ThumbCorner}" HorizontalAlignment="Left" VerticalAlignment="Bottom"/>
|
||||
<Rectangle Style="{StaticResource ThumbCorner}" HorizontalAlignment="Right" VerticalAlignment="Bottom"/>
|
||||
<Viewbox Width="16" Height="16" HorizontalAlignment="Right" VerticalAlignment="Top" IsHitTestVisible="False" Margin="0,-20,0,0">
|
||||
<Path Width="16" Height="16" Stretch="Fill" Fill="{DynamicResource NormalBrush}" StrokeThickness=".5" Stroke="{DynamicResource GlyphBrush}" Data="M 0,8.L 3.18485,4.81417L 3.18485,6.37077L 6.37181,6.37077L 6.37181,3.18408L 4.81418,3.18408L 8.00114,0L 11.1881,3.18408L 9.63047,3.18408L 9.63047,6.37077L 12.8174,6.37077L 12.8174,4.81417L 16.0044,8.L 12.8174,11.1876L 12.8174,9.63096L 9.63047,9.63096L 9.63047,12.8177L 11.1881,12.8177L 8.00114,16.0044L 4.81418,12.8177L 6.37181,12.8177L 6.37181,9.63096L 3.18485,9.63096L 3.18485,11.1876L 0,8. Z M 0,0 Z M 16.0044,16.0044 Z"/>
|
||||
</Viewbox>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,49 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:s="clr-namespace:BrightSharp.Diagrams">
|
||||
|
||||
<s:DoubleFormatConverter x:Key="doubleFormatConverter"/>
|
||||
|
||||
<Style TargetType="{x:Type s:SizeChrome}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type s:SizeChrome}">
|
||||
<Grid SnapsToDevicePixels="True">
|
||||
<Path Stroke="Red"
|
||||
StrokeThickness="1"
|
||||
Height="10"
|
||||
VerticalAlignment="Bottom"
|
||||
Margin="-2,0,-2,-15"
|
||||
Stretch="Fill"
|
||||
Data="M0,0 0,10 M 0,5 100,5 M 100,0 100,10" StrokeDashArray="1 2"/>
|
||||
<TextBlock Text="{Binding Path=Width, Converter={StaticResource doubleFormatConverter}}"
|
||||
Background="White"
|
||||
Padding="3,0,3,0"
|
||||
Foreground="#FF9C3535"
|
||||
Margin="0,0,0,-18"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Bottom"/>
|
||||
<Path Stroke="#FF9C3535"
|
||||
StrokeThickness="1"
|
||||
Width="10"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="0,-2,-15,-2"
|
||||
Stretch="Fill"
|
||||
Data="M5,0 5,100 M 0,0 10,0 M 0,100 10,100" StrokeDashArray="1 2"/>
|
||||
<TextBlock Text="{Binding Path=Height, Converter={StaticResource doubleFormatConverter}}"
|
||||
Background="White"
|
||||
Foreground="#FF9C3535"
|
||||
Padding="3,0,3,0"
|
||||
Margin="0,0,-18,0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center">
|
||||
<TextBlock.LayoutTransform>
|
||||
<RotateTransform Angle="90" CenterX="1" CenterY="0.5"/>
|
||||
</TextBlock.LayoutTransform>
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
5
BrightSharp.NET/BrightSharp.NET/Themes/Generic.xaml
Normal file
5
BrightSharp.NET/BrightSharp.NET/Themes/Generic.xaml
Normal file
@@ -0,0 +1,5 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
|
||||
</ResourceDictionary>
|
||||
326
BrightSharp.NET/BrightSharp.NET/Themes/Style.Blue.xaml
Normal file
326
BrightSharp.NET/BrightSharp.NET/Themes/Style.Blue.xaml
Normal file
@@ -0,0 +1,326 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:s="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<s:Boolean x:Key="IsInverseTheme">False</s:Boolean>
|
||||
|
||||
<CornerRadius x:Key="DefaultRadiusSmall">1</CornerRadius>
|
||||
<CornerRadius x:Key="DefaultRadiusNormal">3</CornerRadius>
|
||||
|
||||
<CornerRadius x:Key="TabItemRadius">0,8,0,0</CornerRadius>
|
||||
<CornerRadius x:Key="TabRadiusTop">0,2,2,2</CornerRadius>
|
||||
<CornerRadius x:Key="TabRadiusLeft">0,5,5,0</CornerRadius>
|
||||
<CornerRadius x:Key="TabRadiusRight">5,0,0,5</CornerRadius>
|
||||
<CornerRadius x:Key="TabRadiusBottom">5,5,0,0</CornerRadius>
|
||||
|
||||
<Color x:Key="ValidationErrorColor">Red</Color>
|
||||
|
||||
<LinearGradientBrush x:Key="NormalBrush" StartPoint="0,1" EndPoint="0,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="White" Offset="1.0"/>
|
||||
<GradientStop Color="#FFC4C8E6" Offset="0.6"/>
|
||||
<GradientStop Color="#FFC0C4DE" Offset="0.55"/>
|
||||
<GradientStop Color="#FFC6DAFF" Offset="0.0"/>
|
||||
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="VerticalNormalBrush" StartPoint="1,0" EndPoint="0,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="White" Offset="1.0"/>
|
||||
<GradientStop Color="#FFC4C8E6" Offset="0.6"/>
|
||||
<GradientStop Color="#FFC0C4DE" Offset="0.55"/>
|
||||
<GradientStop Color="#FFC6DAFF" Offset="0.0"/>
|
||||
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="NormalProgressBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FF3CCF37" Offset="0.0"/>
|
||||
<GradientStop Color="#FF2FA22A" Offset="0.5"/>
|
||||
<GradientStop Color="#FFA6C5A5" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="ProgressBarIndicatorAnimatedFill">
|
||||
<LinearGradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
|
||||
<GradientStop Color="#00ffffff"
|
||||
Offset="0" />
|
||||
<GradientStop Color="#c0ffffff"
|
||||
Offset="0.3" />
|
||||
<GradientStop Color="#d0ffffff"
|
||||
Offset="0.8" />
|
||||
<GradientStop Color="#00ffffff"
|
||||
Offset="1" />
|
||||
</GradientStopCollection>
|
||||
</LinearGradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="ProgressBarIndeterminateRootBrush" EndPoint="0.5,1" StartPoint="0.5,0">
|
||||
<GradientStop Color="#F6BCD5FF" Offset="0.046" />
|
||||
<GradientStop Color="#96D4E4FF" Offset="0.18" />
|
||||
<GradientStop Color="#4FFFFFFF" Offset="0.512" />
|
||||
<GradientStop Color="#00D6D6D6" Offset="0.521" />
|
||||
<GradientStop Color="#BABCD5FF" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="ProgressBarIndeterminateFillBrush" EndPoint="0,1" StartPoint="20,1" MappingMode="Absolute" SpreadMethod="Repeat">
|
||||
<LinearGradientBrush.Transform>
|
||||
<TransformGroup>
|
||||
<SkewTransform AngleX="-10" />
|
||||
</TransformGroup>
|
||||
</LinearGradientBrush.Transform>
|
||||
<GradientStop Color="#FFBCD5FF" Offset="0.088" />
|
||||
<GradientStop Color="#006EA4FD" Offset="0.475" />
|
||||
<GradientStop Color="#FFBCD5FF" Offset="0.899" />
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="NormalBorderBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FF605CBB" Offset="0.0"/>
|
||||
<GradientStop Color="#FF5B4F4F" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
|
||||
<LinearGradientBrush x:Key="HorizontalNormalBorderBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FFACA3D4" Offset="0.0"/>
|
||||
<GradientStop Color="#FF4F2A2A" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<SolidColorBrush x:Key="TopLevelMenuBackgroundHover" Color="#FFFCFFBD" />
|
||||
|
||||
<!-- Light Brush -->
|
||||
|
||||
<LinearGradientBrush x:Key="LightBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="White" Offset="0.0"/>
|
||||
<GradientStop Color="#FFD9E1F9" Offset="0.5"/>
|
||||
<GradientStop Color="#FFDDDDFB" Offset="0.85"/>
|
||||
<GradientStop Color="#FFAFBDE2" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="HorizontalLightBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="White" Offset="0.0"/>
|
||||
<GradientStop Color="#FFD9E1F9" Offset="0.5"/>
|
||||
<GradientStop Color="#FFDDDDFB" Offset="0.85"/>
|
||||
<GradientStop Color="#FF9B9B9B" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<!-- Dark Brush -->
|
||||
|
||||
<LinearGradientBrush x:Key="DarkBrush" StartPoint="0,1" EndPoint="0,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="White" Offset="1.0"/>
|
||||
<GradientStop Color="#FFCCD0E8" Offset="0.6"/>
|
||||
<GradientStop Color="#FFC4CAF1" Offset="0.55"/>
|
||||
<GradientStop Color="#FFD1E1FF" Offset="0.0"/>
|
||||
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="VerticalDarkBrush" StartPoint="1,0" EndPoint="0,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FFCDD6F5" Offset="1.0"/>
|
||||
<GradientStop Color="#FF99A6E6" Offset="0.6"/>
|
||||
<GradientStop Color="#FFB5B3EC" Offset="0.55"/>
|
||||
<GradientStop Color="#FFD8E8FD" Offset="0.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<!-- Pressed Brush -->
|
||||
|
||||
<LinearGradientBrush x:Key="PressedBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FFF6FBC5" Offset="0.0"/>
|
||||
<GradientStop Color="#FFE2D231" Offset="0.2"/>
|
||||
<GradientStop Color="#FFE5FFB9" Offset="0.9"/>
|
||||
<GradientStop Color="#FFF" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
|
||||
<LinearGradientBrush x:Key="TogglePressedBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FFF6FBC5" Offset="0.0"/>
|
||||
<GradientStop Color="#FFE2D231" Offset="0.2"/>
|
||||
<GradientStop Color="#FFE5FFB9" Offset="0.9"/>
|
||||
<GradientStop Color="#FFF" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="VerticalPressedBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FFF6FBC5" Offset="0.0"/>
|
||||
<GradientStop Color="#FFE2D231" Offset="0.2"/>
|
||||
<GradientStop Color="#FFE5FFB9" Offset="0.9"/>
|
||||
<GradientStop Color="#FFF" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="PressedBorderBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FF870000" Offset="0.0"/>
|
||||
<GradientStop Color="#FF5D5D5D" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<!-- Defaulted Brush -->
|
||||
|
||||
<LinearGradientBrush x:Key="DefaultedBorderBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#777" Offset="0.0"/>
|
||||
<GradientStop Color="#000" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<!-- Disabled Brush -->
|
||||
|
||||
<SolidColorBrush x:Key="DisabledForegroundBrush" Color="#FF303030" />
|
||||
<SolidColorBrush x:Key="DisabledBackgroundBrush" Color="#FFB7B7B7" />
|
||||
<SolidColorBrush x:Key="DisabledBorderBrush" Color="#FF7E7070" />
|
||||
|
||||
<!-- Border Brushes -->
|
||||
|
||||
<SolidColorBrush x:Key="SolidBorderBrush" Color="#FF1D426E" />
|
||||
<SolidColorBrush x:Key="LightBorderBrush" Color="#FF9E9E9E" />
|
||||
|
||||
<!-- Miscellaneous Brushes -->
|
||||
|
||||
<LinearGradientBrush x:Key="ScrollBarPageButtonVertBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientStopCollection>
|
||||
<GradientStop Offset="0" Color="#FFD3DBFF" />
|
||||
<GradientStop Offset="0.3" Color="White" />
|
||||
<GradientStop Offset="0.7" Color="White" />
|
||||
<GradientStop Offset="1" Color="#FFD3DBFF" />
|
||||
</GradientStopCollection>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="ScrollBarPageButtonHorizBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientStopCollection>
|
||||
<GradientStop Offset="0" Color="#FFD3DBFF" />
|
||||
<GradientStop Offset="0.3" Color="White" />
|
||||
<GradientStop Offset="0.7" Color="White" />
|
||||
<GradientStop Offset="1" Color="#FFD3DBFF" />
|
||||
</GradientStopCollection>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="TabItemSelectedBackgroundBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FFE0FFC1" Offset="0.0"/>
|
||||
<GradientStop Color="#FFBCE6B2" Offset="0.2"/>
|
||||
<GradientStop Color="#FFE3FFD5" Offset="0.85"/>
|
||||
<GradientStop Color="White" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<SolidColorBrush x:Key="MainMenuForegroundBrush" Color="Black"/>
|
||||
|
||||
|
||||
|
||||
<!--Color STYLED Brush-->
|
||||
|
||||
<LinearGradientBrush x:Key="WindowBackgroundBrush">
|
||||
<GradientStopCollection>
|
||||
<GradientStop Offset="0" Color="#EFEBF8FF" />
|
||||
<GradientStop Offset="1" Color="#EFF3F3F3" />
|
||||
</GradientStopCollection>
|
||||
</LinearGradientBrush>
|
||||
<Color x:Key="WindowBackgroundHoverColor">#FFF</Color>
|
||||
<LinearGradientBrush x:Key="SelectedBackgroundBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientStop Color="#CC9ACBFF" Offset="0" />
|
||||
<GradientStop Color="#FF7DBAFF" Offset=".3" />
|
||||
<GradientStop Color="#FF7DBAFF" Offset=".7" />
|
||||
<GradientStop Color="#CC9ACBFF" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
<SolidColorBrush x:Key="GlyphBrush" Color="#FF2B1717" />
|
||||
<SolidColorBrush x:Key="LightColorBrush" Color="#E9ECF8" />
|
||||
<Color x:Key="OnWindowForegroundColor">#FF1B140F</Color>
|
||||
<Color x:Key="SelectedUnfocusedColor">#FFB6B6B6</Color>
|
||||
<SolidColorBrush x:Key="ScrollBarBackgroundBrush" Color="#F0F0F0" />
|
||||
<SolidColorBrush x:Key="SynWindowBackgroundBrush" Color="#FFD1D1D1" />
|
||||
<Color x:Key="SelectedBackgroundColor">#FFFFF8B8</Color>
|
||||
<SolidColorBrush x:Key="OnWindowForegroundBrush" Color="{DynamicResource OnWindowForegroundColor}" />
|
||||
<SolidColorBrush x:Key="HighLightForegroundBrush" Color="#FF500000" />
|
||||
<Color x:Key="UiForegroundColor">Black</Color>
|
||||
<SolidColorBrush x:Key="AlternatingRowBackgroundBrush" Color="#F1EFFF" />
|
||||
<SolidColorBrush x:Key="RowBackgroundBrush" Color="White"/>
|
||||
<SolidColorBrush x:Key="UiForegroundBrush" Color="{DynamicResource UiForegroundColor}" />
|
||||
<Color x:Key="ControlLightColor">#FFFFFFFF</Color>
|
||||
<Color x:Key="ControlMediumColor">#FFC5C5C5</Color>
|
||||
<Color x:Key="ControlDarkColor">#FF6B6B6B</Color>
|
||||
<Color x:Key="ControlMouseOverColor">#FFDADCEC</Color>
|
||||
<Color x:Key="ControlPressedColor">#FF47909B</Color>
|
||||
<Color x:Key="BorderLightColor">#D6D6D6</Color>
|
||||
<Color x:Key="BorderMediumColor">#E6E6E6</Color>
|
||||
|
||||
<!--Window Brushes-->
|
||||
|
||||
<LinearGradientBrush x:Key="GradientWindowBackgroundBrush" EndPoint="1,1" StartPoint="0,0">
|
||||
<GradientStop Color="#FFAFBAD6" Offset="0"/>
|
||||
<GradientStop Color="White" Offset="1"/>
|
||||
<GradientStop Color="#FFD1E3FF" Offset="0.766"/>
|
||||
<GradientStop Color="#FFE2E8F8" Offset="0.238"/>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="WindowHeaderBrush" EndPoint="0,1">
|
||||
<GradientStop Color="#FFE3F1FF" />
|
||||
<GradientStop Color="#FFABBFEC" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
<SolidColorBrush x:Key="WindowHeaderInactiveBackgroundBrush" Color="#8888" />
|
||||
|
||||
<LinearGradientBrush x:Key="WindowHeaderInactiveBrush" EndPoint="0,1">
|
||||
<GradientStop Color="#A5A5A5" />
|
||||
<GradientStop Color="#FF616161" Offset="0.2" />
|
||||
<GradientStop Color="#FF5C5C5C" Offset="0.8" />
|
||||
<GradientStop Color="#FFBEC5CB" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="WindowBorderBrush" EndPoint="0,1" StartPoint="0,0">
|
||||
<GradientStop Color="#FF898989" Offset="0"/>
|
||||
<GradientStop Color="#FF898989" Offset="1"/>
|
||||
<GradientStop Color="LightGray" Offset="0.841"/>
|
||||
<GradientStop Color="#FFCBCBCB" Offset="0.23"/>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="WindowInnerBorderBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientStop Color="#F0F0F0" Offset="1" />
|
||||
<GradientStop Color="White" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
|
||||
|
||||
|
||||
</ResourceDictionary>
|
||||
283
BrightSharp.NET/BrightSharp.NET/Themes/Style.Classic.xaml
Normal file
283
BrightSharp.NET/BrightSharp.NET/Themes/Style.Classic.xaml
Normal file
@@ -0,0 +1,283 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
|
||||
<!--Radiuses-->
|
||||
|
||||
<CornerRadius x:Key="DefaultRadiusSmall">1</CornerRadius>
|
||||
<CornerRadius x:Key="DefaultRadiusNormal">3</CornerRadius>
|
||||
|
||||
<CornerRadius x:Key="TabItemRadius">0,8,0,0</CornerRadius>
|
||||
<CornerRadius x:Key="TabRadiusTop">0,2,2,2</CornerRadius>
|
||||
<CornerRadius x:Key="TabRadiusLeft">0,5,5,0</CornerRadius>
|
||||
<CornerRadius x:Key="TabRadiusRight">5,0,0,5</CornerRadius>
|
||||
<CornerRadius x:Key="TabRadiusBottom">5,5,0,0</CornerRadius>
|
||||
|
||||
<Color x:Key="ValidationErrorColor">Red</Color>
|
||||
|
||||
<SolidColorBrush x:Key="RowBackgroundBrush" Color="White"/>
|
||||
<LinearGradientBrush x:Key="AlternatingRowBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
|
||||
<GradientStop Color="White"/>
|
||||
<GradientStop Color="White" Offset="1"/>
|
||||
<GradientStop Color="#FFECF5FF" Offset="0.8"/>
|
||||
<GradientStop Color="#FFECF5FF" Offset="0.2"/>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="NormalBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientStop Color="#FFF" Offset="0.0"/>
|
||||
<GradientStop Color="#CCC" Offset="1.0"/>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="VerticalNormalBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FFF" Offset="0.0"/>
|
||||
<GradientStop Color="#CCC" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="ProgressBarIndeterminateRootBrush" EndPoint="0.5,1" StartPoint="0.5,0">
|
||||
<GradientStop Color="#F6BCD5FF" Offset="0.046" />
|
||||
<GradientStop Color="#96D4E4FF" Offset="0.18" />
|
||||
<GradientStop Color="#4FFFFFFF" Offset="0.512" />
|
||||
<GradientStop Color="#00D6D6D6" Offset="0.521" />
|
||||
<GradientStop Color="#BABCD5FF" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="ProgressBarIndeterminateFillBrush" EndPoint="0,1" StartPoint="20,1" MappingMode="Absolute" SpreadMethod="Repeat">
|
||||
<LinearGradientBrush.Transform>
|
||||
<TransformGroup>
|
||||
<SkewTransform AngleX="-10" />
|
||||
</TransformGroup>
|
||||
</LinearGradientBrush.Transform>
|
||||
<GradientStop Color="#FFBCD5FF" Offset="0.088" />
|
||||
<GradientStop Color="#006EA4FD" Offset="0.475" />
|
||||
<GradientStop Color="#FFBCD5FF" Offset="0.899" />
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="NormalProgressBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FF9EFD9B" Offset="0.0"/>
|
||||
<GradientStop Color="#FF2FA22A" Offset="0.4"/>
|
||||
<GradientStop Color="#FFB1ECAF" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="ProgressBarIndicatorAnimatedFill">
|
||||
<LinearGradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
|
||||
<GradientStop Color="#00ffffff"
|
||||
Offset="0" />
|
||||
<GradientStop Color="#c0ffffff"
|
||||
Offset="0.3" />
|
||||
<GradientStop Color="#d0ffffff"
|
||||
Offset="0.8" />
|
||||
<GradientStop Color="#00ffffff"
|
||||
Offset="1" />
|
||||
</GradientStopCollection>
|
||||
</LinearGradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="NormalBorderBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#CCC" Offset="0.0"/>
|
||||
<GradientStop Color="#444" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="HorizontalNormalBorderBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#CCC" Offset="0.0"/>
|
||||
<GradientStop Color="#444" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<SolidColorBrush x:Key="TopLevelMenuBackgroundHover" Color="Pink" />
|
||||
|
||||
<!-- Light Brush -->
|
||||
<LinearGradientBrush x:Key="HorizontalLightBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FFF" Offset="0.0"/>
|
||||
<GradientStop Color="#EEE" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<!-- Dark Brush -->
|
||||
<LinearGradientBrush x:Key="DarkBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FFF" Offset="0.0"/>
|
||||
<GradientStop Color="#AAA" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="VerticalDarkBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FFF" Offset="0.0"/>
|
||||
<GradientStop Color="#AAA" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<!-- Pressed Brush -->
|
||||
<LinearGradientBrush x:Key="PressedBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#E8D4D4" Offset="0.0"/>
|
||||
<GradientStop Color="#E3E8A6" Offset="0.1"/>
|
||||
<GradientStop Color="#ECF699" Offset="0.796"/>
|
||||
<GradientStop Color="#F3F3F3" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="TogglePressedBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#E8D4D4" Offset="0.0"/>
|
||||
<GradientStop Color="#E3E8A6" Offset="0.1"/>
|
||||
<GradientStop Color="#ECF699" Offset="0.796"/>
|
||||
<GradientStop Color="#F3F3F3" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="VerticalPressedBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#E8D4D4" Offset="0.0"/>
|
||||
<GradientStop Color="#E3E8A6" Offset="0.1"/>
|
||||
<GradientStop Color="#ECF699" Offset="0.796"/>
|
||||
<GradientStop Color="#F3F3F3" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="PressedBorderBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#444" Offset="0.0"/>
|
||||
<GradientStop Color="#888" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<!-- Defaulted Brush -->
|
||||
<LinearGradientBrush x:Key="DefaultedBorderBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#777" Offset="0.3"/>
|
||||
<GradientStop Color="#000" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<!-- Disabled Brush -->
|
||||
<SolidColorBrush x:Key="DisabledBorderBrush" Color="#AAA" />
|
||||
|
||||
<!-- Border Brushes -->
|
||||
<SolidColorBrush x:Key="SolidBorderBrush" Color="#888" />
|
||||
<SolidColorBrush x:Key="LightBorderBrush" Color="#AAA" />
|
||||
|
||||
<!-- Miscellaneous Brushes -->
|
||||
<LinearGradientBrush x:Key="ScrollBarPageButtonVertBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientStopCollection>
|
||||
<GradientStop Offset="0" Color="#FFD3DBFF" />
|
||||
<GradientStop Offset="0.3" Color="White" />
|
||||
<GradientStop Offset="0.7" Color="White" />
|
||||
<GradientStop Offset="1" Color="#FFD3DBFF" />
|
||||
</GradientStopCollection>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="ScrollBarPageButtonHorizBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientStopCollection>
|
||||
<GradientStop Offset="0" Color="#FFD3DBFF" />
|
||||
<GradientStop Offset="0.3" Color="White" />
|
||||
<GradientStop Offset="0.7" Color="White" />
|
||||
<GradientStop Offset="1" Color="#FFD3DBFF" />
|
||||
</GradientStopCollection>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="TabItemSelectedBackgroundBrush" 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.85"/>
|
||||
<GradientStop Color="#FFF" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<SolidColorBrush x:Key="MainMenuForegroundBrush" Color="Black"/>
|
||||
|
||||
<!--Color STYLED Brush-->
|
||||
<Color x:Key="WindowBackgroundHoverColor">#FFF</Color>
|
||||
<LinearGradientBrush x:Key="WindowBackgroundBrush">
|
||||
<GradientStop Color="#EEE" />
|
||||
</LinearGradientBrush>
|
||||
<SolidColorBrush x:Key="SelectedBackgroundBrush" Color="#FAE0A0" />
|
||||
<SolidColorBrush x:Key="GlyphBrush" Color="#444" />
|
||||
<SolidColorBrush x:Key="LightColorBrush" Color="#DDD" />
|
||||
<Color x:Key="OnWindowForegroundColor">Black</Color>
|
||||
<SolidColorBrush x:Key="DisabledForegroundBrush" Color="#FF4D4D4D" />
|
||||
<SolidColorBrush x:Key="DisabledBackgroundBrush" Color="#EEE" />
|
||||
<LinearGradientBrush x:Key="LightBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FFF" Offset="0.0"/>
|
||||
<GradientStop Color="#EEE" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<SolidColorBrush x:Key="ScrollBarBackgroundBrush" Color="#F0F0F0" />
|
||||
<SolidColorBrush x:Key="HighLightForegroundBrush" Color="#FF2E2020" />
|
||||
<Color x:Key="SelectedUnfocusedColor">#E0E0EA</Color>
|
||||
<Color x:Key="UiForegroundColor">Black</Color>
|
||||
<Color x:Key="SelectedBackgroundColor">#FAE0A0</Color>
|
||||
<Color x:Key="ControlLightColor">#FFFFFFFF</Color>
|
||||
<Color x:Key="ControlMediumColor">#FFC5C5C5</Color>
|
||||
<Color x:Key="ControlDarkColor">#FF6B6B6B</Color>
|
||||
<Color x:Key="ControlMouseOverColor">#FFDADCEC</Color>
|
||||
<Color x:Key="ControlPressedColor">#FF47909B</Color>
|
||||
<Color x:Key="BorderLightColor">#D6D6D6</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-->
|
||||
|
||||
<SolidColorBrush x:Key="WindowHeaderInactiveBackgroundBrush" Color="#8888" />
|
||||
|
||||
<LinearGradientBrush x:Key="GradientWindowBackgroundBrush" EndPoint="1,1" StartPoint="0,0">
|
||||
|
||||
<GradientStop Color="White" Offset="1"/>
|
||||
<GradientStop Color="#FFE9F2FF" Offset="0.766"/>
|
||||
<GradientStop Color="#FFE2E8F8" Offset="0.238"/>
|
||||
<GradientStop Color="#FFD0D8EC" Offset="0"/>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="WindowHeaderBrush" EndPoint="0,1">
|
||||
<GradientStop Color="#F4F4FF" />
|
||||
<GradientStop Color="#FFD4EAFF" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="WindowHeaderInactiveBrush" EndPoint="0,1">
|
||||
<GradientStop Color="#A5A5A5" />
|
||||
<GradientStop Color="#FF616161" Offset="0.2" />
|
||||
<GradientStop Color="#FF5C5C5C" Offset="0.8" />
|
||||
<GradientStop Color="#FFBEC5CB" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="WindowBorderBrush" EndPoint="0,1" StartPoint="0,0">
|
||||
<GradientStop Color="#FF898989" Offset="0"/>
|
||||
<GradientStop Color="#FF898989" Offset="1"/>
|
||||
<GradientStop Color="LightGray" Offset="0.841"/>
|
||||
<GradientStop Color="#FFCBCBCB" Offset="0.23"/>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="WindowInnerBorderBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientStop Color="#F0F0F0" Offset="1" />
|
||||
<GradientStop Color="White" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
|
||||
</ResourceDictionary>
|
||||
307
BrightSharp.NET/BrightSharp.NET/Themes/Style.DarkBlue.xaml
Normal file
307
BrightSharp.NET/BrightSharp.NET/Themes/Style.DarkBlue.xaml
Normal file
@@ -0,0 +1,307 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<sys:Boolean x:Key="IsInverseTheme">True</sys:Boolean>
|
||||
|
||||
<CornerRadius x:Key="DefaultRadiusSmall">1</CornerRadius>
|
||||
<CornerRadius x:Key="DefaultRadiusNormal">3</CornerRadius>
|
||||
|
||||
<CornerRadius x:Key="TabItemRadius">0,8,0,0</CornerRadius>
|
||||
<CornerRadius x:Key="TabRadiusTop">0,2,2,2</CornerRadius>
|
||||
<CornerRadius x:Key="TabRadiusLeft">0,5,5,0</CornerRadius>
|
||||
<CornerRadius x:Key="TabRadiusRight">5,0,0,5</CornerRadius>
|
||||
<CornerRadius x:Key="TabRadiusBottom">5,5,0,0</CornerRadius>
|
||||
|
||||
|
||||
<Color x:Key="SelectedBackgroundColor" >#99BDFF</Color>
|
||||
<Color x:Key="SelectedUnfocusedColor" >#999999</Color>
|
||||
<Color x:Key="ControlLightColor" >#FF2F596E</Color>
|
||||
<Color x:Key="ControlMediumColor" >#FF10405B</Color>
|
||||
<Color x:Key="ControlDarkColor" >#FF2B404B</Color>
|
||||
|
||||
<Color x:Key="ControlMouseOverColor" >#FF414888</Color>
|
||||
<Color x:Key="ControlPressedColor" >#FF47909B</Color>
|
||||
<Color x:Key="BorderLightColor">#D6D6D6</Color>
|
||||
<Color x:Key="BorderMediumColor">#E6E6E6</Color>
|
||||
|
||||
<Color x:Key="ValidationErrorColor" >#FF3333</Color>
|
||||
|
||||
<Color x:Key="UiForegroundColor">#ffffff</Color>
|
||||
<SolidColorBrush x:Key="UiForegroundBrush" Color="White" />
|
||||
<Color x:Key="WindowBackgroundHoverColor">#555555</Color>
|
||||
|
||||
<SolidColorBrush x:Key="TopLevelMenuBackgroundHover" Color="#FF414566" />
|
||||
<SolidColorBrush x:Key="DisabledBorderBrush" Color="#FF575757" />
|
||||
|
||||
<SolidColorBrush x:Key="SolidBorderBrush" Color="Black" />
|
||||
<SolidColorBrush x:Key="LightBorderBrush" Color="DarkGray" />
|
||||
<SolidColorBrush x:Key="MainMenuForegroundBrush" Color="White"/>
|
||||
|
||||
<SolidColorBrush x:Key="WindowBackgroundBrush" Color="#444444" />
|
||||
|
||||
<LinearGradientBrush x:Key="GradientWindowBackgroundBrush" EndPoint="1,1" StartPoint="0,0">
|
||||
<GradientStop Color="#FF35373C" Offset="0"/>
|
||||
<GradientStop Color="#FF32353C" Offset="0.2"/>
|
||||
<GradientStop Color="#FF242629" Offset="0.75"/>
|
||||
<GradientStop Color="#FF222326" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="WindowHeaderBrush" EndPoint="0,1">
|
||||
<GradientStop Color="#FF556176" />
|
||||
<GradientStop Color="#FF282B32" Offset="0.2" />
|
||||
<GradientStop Color="#FF262634" Offset="0.8" />
|
||||
<GradientStop Color="#FF15212C" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="WindowBorderBrush" EndPoint="0,1" StartPoint="0,0">
|
||||
<GradientStop Color="#FF2E2E2E" Offset="0"/>
|
||||
<GradientStop Color="#FF1B1B1B" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="WindowInnerBorderBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientStop Color="#181818" Offset="1" />
|
||||
<GradientStop Color="#1D1C21" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="WindowHeaderInactiveBrush" EndPoint="0,1">
|
||||
<GradientStop Color="#5E5E5E" />
|
||||
<GradientStop Color="#FF3B3B3B" Offset="0.2" />
|
||||
<GradientStop Color="#FF3B3B3B" Offset="0.8" />
|
||||
<GradientStop Color="#5E5E5E" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
<SolidColorBrush x:Key="GlyphBrush" Color="#ffffff" />
|
||||
<SolidColorBrush x:Key="LightColorBrush" Color="#FF57575F" />
|
||||
|
||||
<Color x:Key="OnWindowForegroundColor">White</Color>
|
||||
<SolidColorBrush x:Key="OnWindowForegroundBrush" Color="{DynamicResource OnWindowForegroundColor}" />
|
||||
<SolidColorBrush x:Key="DisabledForegroundBrush" Color="#bbb" />
|
||||
<SolidColorBrush x:Key="DisabledBackgroundBrush" Color="#FF303030" />
|
||||
|
||||
<SolidColorBrush x:Key="ScrollBarBackgroundBrush" Color="#FF404040" />
|
||||
|
||||
<SolidColorBrush x:Key="HighLightForegroundBrush" Color="Black" />
|
||||
|
||||
<SolidColorBrush x:Key="AlternatingRowBackgroundBrush" Color="#555555" />
|
||||
<SolidColorBrush x:Key="RowBackgroundBrush" Color="#6C6C6C" />
|
||||
|
||||
|
||||
<LinearGradientBrush x:Key="NormalBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FF08547D" Offset="0.02"/>
|
||||
<GradientStop Color="#FF2A546A" Offset="0.25"/>
|
||||
<GradientStop Color="#FF1F3A49" Offset="0.75"/>
|
||||
<GradientStop Color="#FF3A6F90" Offset="1"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="VerticalNormalBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FF2F596E" Offset="0.02"/>
|
||||
<GradientStop Color="#FF10405B" Offset="1"/>
|
||||
<GradientStop Color="#FF2B404B" Offset="0.209"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="NormalBorderBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FF7A8DAA" Offset="0.0"/>
|
||||
<GradientStop Color="#FF4B4B4B" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="HorizontalNormalBorderBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FF6C6C6C" Offset="0.0"/>
|
||||
<GradientStop Color="#FF8B8B8B" Offset=".5"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<!-- Light Brush -->
|
||||
|
||||
<LinearGradientBrush x:Key="HorizontalLightBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FF616161" Offset="0.0"/>
|
||||
<GradientStop Color="#FF3F3E49" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="DarkBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FF2F4249" Offset="0"/>
|
||||
<GradientStop Color="#FF2D566C" Offset="1"/>
|
||||
<GradientStop Color="#FF004161" Offset="0.507"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="VerticalDarkBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FF5C7783" Offset="0.0"/>
|
||||
<GradientStop Color="#FF47545B" Offset="1"/>
|
||||
<GradientStop Color="#FF134B66" Offset="0.557"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<!-- Pressed Brush -->
|
||||
<LinearGradientBrush x:Key="PressedBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FF368BB4" Offset="0.0"/>
|
||||
<GradientStop Color="#FF306178" Offset="0.55"/>
|
||||
<GradientStop Color="#FF37738F" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="TogglePressedBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FF156489" Offset="0.0"/>
|
||||
<GradientStop Color="#FF2B86B2" Offset="0.2"/>
|
||||
<GradientStop Color="#FF2187B8" Offset="0.55"/>
|
||||
<GradientStop Color="#FF358FB9" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="VerticalPressedBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FF368BB4" Offset="0.0"/>
|
||||
<GradientStop Color="#FF306178" Offset="0.55"/>
|
||||
<GradientStop Color="#FF37738F" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="PressedBorderBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#444" Offset="0.0"/>
|
||||
<GradientStop Color="#888" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<!-- Defaulted Brush -->
|
||||
|
||||
<LinearGradientBrush x:Key="DefaultedBorderBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#777" Offset="0.3"/>
|
||||
<GradientStop Color="#000" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<!-- Disabled Brush -->
|
||||
|
||||
|
||||
<!-- Border Brushes -->
|
||||
|
||||
<!-- Miscellaneous Brushes -->
|
||||
|
||||
<LinearGradientBrush x:Key="ScrollBarPageButtonVertBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientStopCollection>
|
||||
<GradientStop Offset="0" Color="#FF707070" />
|
||||
<GradientStop Offset="0.3" Color="#FF494949" />
|
||||
<GradientStop Offset="0.7" Color="#FF494949" />
|
||||
<GradientStop Offset="1" Color="#FF707070" />
|
||||
</GradientStopCollection>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="ScrollBarPageButtonHorizBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientStopCollection>
|
||||
<GradientStop Offset="0" Color="#FF707070" />
|
||||
<GradientStop Offset="0.3" Color="#FF494949" />
|
||||
<GradientStop Offset="0.7" Color="#FF494949" />
|
||||
<GradientStop Offset="1" Color="#FF707070" />
|
||||
</GradientStopCollection>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="TabItemSelectedBackgroundBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FF3DE459" Offset="0"/>
|
||||
<GradientStop Color="#FF0071A8" Offset="0.05"/>
|
||||
<GradientStop Color="#FF0071A8" Offset="0.5"/>
|
||||
<GradientStop Color="#FF0B374F" Offset="1"/>
|
||||
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
|
||||
|
||||
<!--Color STYLED Brush-->
|
||||
|
||||
|
||||
<LinearGradientBrush x:Key="SelectedBackgroundBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientStop Color="#CC9ACBFF" Offset="0" />
|
||||
<GradientStop Color="#FF7DBAFF" Offset=".3" />
|
||||
<GradientStop Color="#FF7DBAFF" Offset=".7" />
|
||||
<GradientStop Color="#CC9ACBFF" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
|
||||
<LinearGradientBrush x:Key="LightBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FF616161" Offset="0.0"/>
|
||||
<GradientStop Color="#FF3F3E49" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="ListViewFileItemBrush">
|
||||
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="ProgressBarIndeterminateRootBrush" EndPoint="0.5,1" StartPoint="0.5,0">
|
||||
<GradientStop Color="#F6BCD5FF" Offset="0.046" />
|
||||
<GradientStop Color="#96D4E4FF" Offset="0.18" />
|
||||
<GradientStop Color="#4FFFFFFF" Offset="0.512" />
|
||||
<GradientStop Color="#00D6D6D6" Offset="0.521" />
|
||||
<GradientStop Color="#BABCD5FF" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="ProgressBarIndeterminateFillBrush" EndPoint="0,1" StartPoint="20,1" MappingMode="Absolute" SpreadMethod="Repeat">
|
||||
<LinearGradientBrush.Transform>
|
||||
<TransformGroup>
|
||||
<SkewTransform AngleX="-10" />
|
||||
</TransformGroup>
|
||||
</LinearGradientBrush.Transform>
|
||||
<GradientStop Color="#FFBCD5FF" Offset="0.088" />
|
||||
<GradientStop Color="#006EA4FD" Offset="0.475" />
|
||||
<GradientStop Color="#FFBCD5FF" Offset="0.899" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
|
||||
<LinearGradientBrush x:Key="NormalProgressBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FF9BA8FD" Offset="0.0"/>
|
||||
<GradientStop Color="#FF0B1C89" Offset="0.4"/>
|
||||
<GradientStop Color="#FF4B678F" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="ProgressBarIndicatorAnimatedFill">
|
||||
<LinearGradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
|
||||
<GradientStop Color="#00eeeeee"
|
||||
Offset="0" />
|
||||
<GradientStop Color="#c0eeeeee"
|
||||
Offset="0.3" />
|
||||
<GradientStop Color="#d0eeeeee"
|
||||
Offset="0.8" />
|
||||
<GradientStop Color="#00eeeeee"
|
||||
Offset="1" />
|
||||
</GradientStopCollection>
|
||||
</LinearGradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<SolidColorBrush x:Key="WindowHeaderInactiveBackgroundBrush" Color="#8888" />
|
||||
</ResourceDictionary>
|
||||
274
BrightSharp.NET/BrightSharp.NET/Themes/Style.DevLab.xaml
Normal file
274
BrightSharp.NET/BrightSharp.NET/Themes/Style.DevLab.xaml
Normal file
@@ -0,0 +1,274 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<system:Boolean x:Key="IsInverseTheme">False</system:Boolean>
|
||||
|
||||
<CornerRadius x:Key="DefaultRadiusSmall">0</CornerRadius>
|
||||
<CornerRadius x:Key="DefaultRadiusNormal">1</CornerRadius>
|
||||
|
||||
|
||||
<CornerRadius x:Key="TabRadiusTop">0</CornerRadius>
|
||||
<CornerRadius x:Key="TabRadiusLeft">0</CornerRadius>
|
||||
<CornerRadius x:Key="TabRadiusRight">0</CornerRadius>
|
||||
<CornerRadius x:Key="TabRadiusBottom">0</CornerRadius>
|
||||
<CornerRadius x:Key="TabItemRadius">0,2,0,0</CornerRadius>
|
||||
|
||||
|
||||
<Color x:Key="ValidationErrorColor">Red</Color>
|
||||
|
||||
<SolidColorBrush x:Key="NormalBrush" Color="#FFEDEFFF" />
|
||||
<SolidColorBrush x:Key="VerticalNormalBrush" Color="#FFDFE1EF" />
|
||||
|
||||
<LinearGradientBrush x:Key="ProgressBarIndeterminateRootBrush" EndPoint="0.5,1" StartPoint="0.5,0">
|
||||
<GradientStop Color="#F6BCD5FF" Offset="0.046" />
|
||||
<GradientStop Color="#96D4E4FF" Offset="0.18" />
|
||||
<GradientStop Color="#4FFFFFFF" Offset="0.512" />
|
||||
<GradientStop Color="#00D6D6D6" Offset="0.521" />
|
||||
<GradientStop Color="#BABCD5FF" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="ProgressBarIndeterminateFillBrush" EndPoint="0,1" StartPoint="20,1" MappingMode="Absolute" SpreadMethod="Repeat">
|
||||
<LinearGradientBrush.Transform>
|
||||
<TransformGroup>
|
||||
<SkewTransform AngleX="-10" />
|
||||
</TransformGroup>
|
||||
</LinearGradientBrush.Transform>
|
||||
<GradientStop Color="#FFBCD5FF" Offset="0.088" />
|
||||
<GradientStop Color="#006EA4FD" Offset="0.475" />
|
||||
<GradientStop Color="#FFBCD5FF" Offset="0.899" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
|
||||
<LinearGradientBrush x:Key="NormalProgressBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FF678D66" Offset="0.0"/>
|
||||
<GradientStop Color="#FF2FA22A" Offset="0.4"/>
|
||||
<GradientStop Color="#FF576A56" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="ProgressBarIndicatorAnimatedFill">
|
||||
<LinearGradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
|
||||
<GradientStop Color="#00ffffff"
|
||||
Offset="0" />
|
||||
<GradientStop Color="#c0ffffff"
|
||||
Offset="0.3" />
|
||||
<GradientStop Color="#d0ffffff"
|
||||
Offset="0.8" />
|
||||
<GradientStop Color="#00ffffff"
|
||||
Offset="1" />
|
||||
</GradientStopCollection>
|
||||
</LinearGradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="NormalBorderBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#CCC" Offset="0.0"/>
|
||||
<GradientStop Color="#444" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
|
||||
<LinearGradientBrush x:Key="HorizontalNormalBorderBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#CCC" Offset="0.0"/>
|
||||
<GradientStop Color="#444" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<SolidColorBrush x:Key="TopLevelMenuBackgroundHover" Color="White" />
|
||||
|
||||
<!-- Light Brush -->
|
||||
|
||||
|
||||
<LinearGradientBrush x:Key="HorizontalLightBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FFF" Offset="0.0"/>
|
||||
<GradientStop Color="#EEE" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<!-- Dark Brush -->
|
||||
|
||||
<LinearGradientBrush x:Key="DarkBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FFF" Offset="0.0"/>
|
||||
<GradientStop Color="#FFD7DDFF" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="VerticalDarkBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FFF" Offset="0.0"/>
|
||||
<GradientStop Color="#FFD7DDFF" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<!-- Pressed Brush -->
|
||||
|
||||
<LinearGradientBrush x:Key="PressedBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="White" Offset="0.0"/>
|
||||
<GradientStop Color="#FFFFBC8D" Offset="0.1"/>
|
||||
<GradientStop Color="#FFFFB49E" Offset="0.796"/>
|
||||
<GradientStop Color="#FFFFF4F4" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="TogglePressedBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="White" Offset="0.0"/>
|
||||
<GradientStop Color="#FFFFBC8D" Offset="0.1"/>
|
||||
<GradientStop Color="#FFFFB49E" Offset="0.796"/>
|
||||
<GradientStop Color="#FFFFF4F4" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="VerticalPressedBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="White" Offset="0.0"/>
|
||||
<GradientStop Color="#FFFFBC8D" Offset="0.1"/>
|
||||
<GradientStop Color="#FFFFB49E" Offset="0.796"/>
|
||||
<GradientStop Color="#FFFFF4F4" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="PressedBorderBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#444" Offset="0.0"/>
|
||||
<GradientStop Color="#444" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<!-- Defaulted Brush -->
|
||||
|
||||
<SolidColorBrush x:Key="DefaultedBorderBrush" Color="Black"/>
|
||||
|
||||
<!-- Disabled Brush -->
|
||||
|
||||
<SolidColorBrush x:Key="DisabledBorderBrush" Color="#AAA" />
|
||||
|
||||
<!-- Border Brushes -->
|
||||
|
||||
<SolidColorBrush x:Key="SolidBorderBrush" Color="#888" />
|
||||
<SolidColorBrush x:Key="LightBorderBrush" Color="#AAA" />
|
||||
|
||||
<!-- Miscellaneous Brushes -->
|
||||
|
||||
<SolidColorBrush x:Key="ScrollBarPageButtonVertBrush" Color="#FFF3F3F3" />
|
||||
|
||||
<SolidColorBrush x:Key="ScrollBarPageButtonHorizBrush" Color="White" />
|
||||
|
||||
|
||||
<SolidColorBrush x:Key="TabItemSelectedBackgroundBrush" Color="#FFF0E0FF"/>
|
||||
|
||||
<SolidColorBrush x:Key="MainMenuForegroundBrush" Color="Black"/>
|
||||
|
||||
|
||||
<!--Color STYLED Brush-->
|
||||
|
||||
<SolidColorBrush x:Key="WindowBackgroundBrush" Color="White" />
|
||||
|
||||
<Color x:Key="WindowBackgroundHoverColor">White</Color>
|
||||
|
||||
<SolidColorBrush x:Key="SelectedBackgroundBrush" Color="#FFFFE0E0" />
|
||||
<SolidColorBrush x:Key="GlyphBrush" Color="#444" />
|
||||
<SolidColorBrush x:Key="LightColorBrush" Color="#FFF3F3F3" />
|
||||
|
||||
<Color x:Key="OnWindowForegroundColor">Black</Color>
|
||||
<SolidColorBrush x:Key="OnWindowForegroundBrush" Color="{DynamicResource OnWindowForegroundColor}" />
|
||||
<SolidColorBrush x:Key="DisabledForegroundBrush" Color="#FF4D4D4D" />
|
||||
<SolidColorBrush x:Key="DisabledBackgroundBrush" Color="#EEE" />
|
||||
|
||||
|
||||
<LinearGradientBrush x:Key="LightBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="White" Offset="0.0"/>
|
||||
<GradientStop Color="#FFF3F3F3" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<SolidColorBrush x:Key="ScrollBarBackgroundBrush" Color="#F0F0F0" />
|
||||
<SolidColorBrush x:Key="SynWindowBackgroundBrush" Color="#FFE4E4E4" />
|
||||
|
||||
<SolidColorBrush x:Key="HighLightForegroundBrush" Color="#FF500000" />
|
||||
|
||||
<Color x:Key="UiForegroundColor">Black</Color>
|
||||
<SolidColorBrush x:Key="UiForegroundBrush" Color="{DynamicResource UiForegroundColor}" />
|
||||
|
||||
|
||||
<SolidColorBrush x:Key="AlternatingRowBackgroundBrush" Color="#F1F1F1" />
|
||||
<SolidColorBrush x:Key="RowBackgroundBrush" Color="White"/>
|
||||
|
||||
|
||||
<Color x:Key="SelectedBackgroundColor">#E3E3E3</Color>
|
||||
<Color x:Key="SelectedUnfocusedColor">#FFD6E6E6</Color>
|
||||
<Color x:Key="ControlLightColor">#FFFFFFFF</Color>
|
||||
<Color x:Key="ControlMediumColor">#FFC5C5C5</Color>
|
||||
<Color x:Key="ControlDarkColor">#FF6B6B6B</Color>
|
||||
|
||||
<Color x:Key="ControlMouseOverColor">#FFEEEEEE</Color>
|
||||
<Color x:Key="ControlPressedColor">#FF47909B</Color>
|
||||
<Color x:Key="BorderLightColor">#D6D6D6</Color>
|
||||
<Color x:Key="BorderMediumColor">#E6E6E6</Color>
|
||||
|
||||
<!--Window Brushes-->
|
||||
|
||||
<SolidColorBrush x:Key="WindowHeaderInactiveBackgroundBrush" Color="#8888" />
|
||||
|
||||
<LinearGradientBrush x:Key="GradientWindowBackgroundBrush" EndPoint="1,1" StartPoint="0,0">
|
||||
|
||||
<GradientStop Color="White" Offset="1"/>
|
||||
<GradientStop Color="#FFE9F2FF" Offset="0.766"/>
|
||||
<GradientStop Color="#FFE2E8F8" Offset="0.238"/>
|
||||
<GradientStop Color="#FFD0D8EC" Offset="0"/>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="WindowHeaderBrush" EndPoint="0,1">
|
||||
<GradientStop Color="#F4F4FF" />
|
||||
<GradientStop Color="#FFD4EAFF" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="WindowHeaderInactiveBrush" EndPoint="0,1">
|
||||
<GradientStop Color="#A5A5A5" />
|
||||
<GradientStop Color="#FF616161" Offset="0.2" />
|
||||
<GradientStop Color="#FF5C5C5C" Offset="0.8" />
|
||||
<GradientStop Color="#FFBEC5CB" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="WindowBorderBrush" EndPoint="0,1" StartPoint="0,0">
|
||||
<GradientStop Color="#FF898989" Offset="0"/>
|
||||
<GradientStop Color="#FF898989" Offset="1"/>
|
||||
<GradientStop Color="LightGray" Offset="0.841"/>
|
||||
<GradientStop Color="#FFCBCBCB" Offset="0.23"/>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="WindowInnerBorderBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientStop Color="#F0F0F0" Offset="1" />
|
||||
<GradientStop Color="White" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
|
||||
</ResourceDictionary>
|
||||
324
BrightSharp.NET/BrightSharp.NET/Themes/Style.Silver.xaml
Normal file
324
BrightSharp.NET/BrightSharp.NET/Themes/Style.Silver.xaml
Normal file
@@ -0,0 +1,324 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<sys:Boolean x:Key="IsInverseTheme">False</sys:Boolean>
|
||||
|
||||
<CornerRadius x:Key="DefaultRadiusSmall">1</CornerRadius>
|
||||
<CornerRadius x:Key="DefaultRadiusNormal">3</CornerRadius>
|
||||
|
||||
<CornerRadius x:Key="TabItemRadius">0,8,0,0</CornerRadius>
|
||||
<CornerRadius x:Key="TabRadiusTop">0,2,2,2</CornerRadius>
|
||||
<CornerRadius x:Key="TabRadiusLeft">0,5,5,0</CornerRadius>
|
||||
<CornerRadius x:Key="TabRadiusRight">5,0,0,5</CornerRadius>
|
||||
<CornerRadius x:Key="TabRadiusBottom">5,5,0,0</CornerRadius>
|
||||
|
||||
<Color x:Key="ValidationErrorColor">Red</Color>
|
||||
|
||||
<LinearGradientBrush x:Key="NormalBrush" 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="VerticalNormalBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FFF" Offset="0.0"/>
|
||||
<GradientStop Color="#CCC" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="ProgressBarIndeterminateRootBrush" EndPoint="0.5,1" StartPoint="0.5,0">
|
||||
<GradientStop Color="#F6BCD5FF" Offset="0.046" />
|
||||
<GradientStop Color="#96D4E4FF" Offset="0.18" />
|
||||
<GradientStop Color="#4FFFFFFF" Offset="0.512" />
|
||||
<GradientStop Color="#00D6D6D6" Offset="0.521" />
|
||||
<GradientStop Color="#BABCD5FF" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="ProgressBarIndeterminateFillBrush" EndPoint="0,1" StartPoint="20,1" MappingMode="Absolute" SpreadMethod="Repeat">
|
||||
<LinearGradientBrush.Transform>
|
||||
<TransformGroup>
|
||||
<SkewTransform AngleX="-10" />
|
||||
</TransformGroup>
|
||||
</LinearGradientBrush.Transform>
|
||||
<GradientStop Color="#FFBCD5FF" Offset="0.088" />
|
||||
<GradientStop Color="#006EA4FD" Offset="0.475" />
|
||||
<GradientStop Color="#FFBCD5FF" Offset="0.899" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
|
||||
<LinearGradientBrush x:Key="NormalProgressBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FF9B9B9B" Offset="0"/>
|
||||
<GradientStop Color="#FFB9B9B9" Offset="0.5"/>
|
||||
<GradientStop Color="#FFE8E8E8" Offset="1"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="ProgressBarIndicatorAnimatedFill">
|
||||
<LinearGradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
|
||||
<GradientStop Color="#00ffffff"
|
||||
Offset="0" />
|
||||
<GradientStop Color="#c0ffffff"
|
||||
Offset="0.3" />
|
||||
<GradientStop Color="#d0ffffff"
|
||||
Offset="0.8" />
|
||||
<GradientStop Color="#00ffffff"
|
||||
Offset="1" />
|
||||
</GradientStopCollection>
|
||||
</LinearGradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="NormalBorderBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#CCC" Offset="0.0"/>
|
||||
<GradientStop Color="#444" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
|
||||
<LinearGradientBrush x:Key="HorizontalNormalBorderBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#CCC" Offset="0.0"/>
|
||||
<GradientStop Color="#444" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<SolidColorBrush x:Key="TopLevelMenuBackgroundHover" Color="Pink" />
|
||||
|
||||
<!-- Light Brush -->
|
||||
|
||||
|
||||
<LinearGradientBrush x:Key="HorizontalLightBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FFF" Offset="0.0"/>
|
||||
<GradientStop Color="#EEE" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<!-- Dark Brush -->
|
||||
|
||||
<LinearGradientBrush x:Key="DarkBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FFF" Offset="0.0"/>
|
||||
<GradientStop Color="#AAA" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="VerticalDarkBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FFF" Offset="0.0"/>
|
||||
<GradientStop Color="#AAA" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<!-- Pressed Brush -->
|
||||
|
||||
<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>
|
||||
|
||||
<LinearGradientBrush x:Key="TogglePressedBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#E8D4D4" Offset="0.0"/>
|
||||
<GradientStop Color="#E3E8A6" Offset="0.1"/>
|
||||
<GradientStop Color="#ECF699" Offset="0.796"/>
|
||||
<GradientStop Color="#F3F3F3" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="VerticalPressedBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<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>
|
||||
|
||||
<LinearGradientBrush x:Key="PressedBorderBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#444" Offset="0.0"/>
|
||||
<GradientStop Color="#888" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<!-- Defaulted Brush -->
|
||||
|
||||
<LinearGradientBrush x:Key="DefaultedBorderBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#777" Offset="0.3"/>
|
||||
<GradientStop Color="#000" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<!-- Disabled Brush -->
|
||||
|
||||
<SolidColorBrush x:Key="DisabledBorderBrush" Color="#AAA" />
|
||||
|
||||
<!-- Border Brushes -->
|
||||
|
||||
<SolidColorBrush x:Key="SolidBorderBrush" Color="#888" />
|
||||
<SolidColorBrush x:Key="LightBorderBrush" Color="#AAA" />
|
||||
|
||||
<!-- Miscellaneous Brushes -->
|
||||
|
||||
<LinearGradientBrush x:Key="ScrollBarPageButtonVertBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientStopCollection>
|
||||
<GradientStop Offset="0" Color="#FFD3DBFF" />
|
||||
<GradientStop Offset="0.3" Color="White" />
|
||||
<GradientStop Offset="0.7" Color="White" />
|
||||
<GradientStop Offset="1" Color="#FFD3DBFF" />
|
||||
</GradientStopCollection>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="ScrollBarPageButtonHorizBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientStopCollection>
|
||||
<GradientStop Offset="0" Color="#FFD3DBFF" />
|
||||
<GradientStop Offset="0.3" Color="White" />
|
||||
<GradientStop Offset="0.7" Color="White" />
|
||||
<GradientStop Offset="1" Color="#FFD3DBFF" />
|
||||
</GradientStopCollection>
|
||||
</LinearGradientBrush>
|
||||
|
||||
|
||||
<LinearGradientBrush x:Key="TabItemSelectedBackgroundBrush" 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.85"/>
|
||||
<GradientStop Color="#FFF" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<SolidColorBrush x:Key="MainMenuForegroundBrush" Color="Black"/>
|
||||
|
||||
|
||||
<!--Color STYLED Brush-->
|
||||
|
||||
<LinearGradientBrush x:Key="WindowBackgroundBrush">
|
||||
<GradientStop Color="#EEE" />
|
||||
</LinearGradientBrush>
|
||||
<Color x:Key="WindowBackgroundHoverColor">#FFF</Color>
|
||||
|
||||
<LinearGradientBrush x:Key="SelectedBackgroundBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientStop Color="#CC9ACBFF" Offset="0" />
|
||||
<GradientStop Color="#FF7DBAFF" Offset=".3" />
|
||||
<GradientStop Color="#FF7DBAFF" Offset=".7" />
|
||||
<GradientStop Color="#CC9ACBFF" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
<SolidColorBrush x:Key="GlyphBrush" Color="#444" />
|
||||
<SolidColorBrush x:Key="LightColorBrush" Color="#DDD" />
|
||||
|
||||
<Color x:Key="OnWindowForegroundColor">Black</Color>
|
||||
<SolidColorBrush x:Key="OnWindowForegroundBrush" Color="{DynamicResource OnWindowForegroundColor}" />
|
||||
<SolidColorBrush x:Key="DisabledForegroundBrush" Color="#FF4D4D4D" />
|
||||
<SolidColorBrush x:Key="DisabledBackgroundBrush" Color="#EEE" />
|
||||
|
||||
|
||||
<SolidColorBrush x:Key="AlternatingRowBackgroundBrush" Color="#E6E6E6" />
|
||||
<SolidColorBrush x:Key="RowBackgroundBrush" Color="White"/>
|
||||
|
||||
<LinearGradientBrush x:Key="LightBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FFF" Offset="0.0"/>
|
||||
<GradientStop Color="#EEE" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<SolidColorBrush x:Key="ScrollBarBackgroundBrush" Color="#F0F0F0" />
|
||||
<LinearGradientBrush x:Key="GradientWindowBackgroundBrush" EndPoint="1,1" StartPoint="0,0">
|
||||
<GradientStop Color="White" Offset="0"/>
|
||||
<GradientStop Color="#FFF8F8F8" Offset="0.2"/>
|
||||
<GradientStop Color="#FFE3E3E3" Offset="0.75"/>
|
||||
<GradientStop Color="White" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<SolidColorBrush x:Key="HighLightForegroundBrush" Color="#410000" />
|
||||
|
||||
<Color x:Key="UiForegroundColor">Black</Color>
|
||||
<SolidColorBrush x:Key="UiForegroundBrush" Color="{DynamicResource UiForegroundColor}" />
|
||||
|
||||
|
||||
|
||||
|
||||
<Color x:Key="SelectedBackgroundColor">#DEDEDE</Color>
|
||||
<Color x:Key="SelectedUnfocusedColor">#FFB6B6B6</Color>
|
||||
<Color x:Key="ControlLightColor">#FFFFFFFF</Color>
|
||||
<Color x:Key="ControlMediumColor">#FFC5C5C5</Color>
|
||||
<Color x:Key="ControlDarkColor">#FF6B6B6B</Color>
|
||||
|
||||
<Color x:Key="ControlMouseOverColor">#FFCED0E1</Color>
|
||||
<Color x:Key="ControlPressedColor">#FF47909B</Color>
|
||||
|
||||
<Color x:Key="BorderLightColor">#D6D6D6</Color>
|
||||
<Color x:Key="BorderMediumColor">#E6E6E6</Color>
|
||||
|
||||
<!--Window Brushes-->
|
||||
|
||||
<LinearGradientBrush x:Key="WindowHeaderBrush" EndPoint="0,1">
|
||||
<GradientStop Color="#9EF4F4FF" />
|
||||
<GradientStop Color="#80B5BBC6" Offset="0.2" />
|
||||
<GradientStop Color="#93E7E7FC" Offset="0.8" />
|
||||
<GradientStop Color="#A9D4EAFF" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
<SolidColorBrush x:Key="WindowHeaderInactiveBackgroundBrush" Color="#8888" />
|
||||
|
||||
<LinearGradientBrush x:Key="WindowHeaderInactiveBrush" EndPoint="0,1">
|
||||
<GradientStop Color="#A5A5A5" />
|
||||
<GradientStop Color="#FF616161" Offset="0.2" />
|
||||
<GradientStop Color="#FF5C5C5C" Offset="0.8" />
|
||||
<GradientStop Color="#FFBEC5CB" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="WindowBorderBrush" EndPoint="0,1" StartPoint="0,0">
|
||||
<GradientStop Color="#FF898989" Offset="0"/>
|
||||
<GradientStop Color="#FF898989" Offset="1"/>
|
||||
<GradientStop Color="LightGray" Offset="0.841"/>
|
||||
<GradientStop Color="#FFCBCBCB" Offset="0.23"/>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="WindowInnerBorderBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientStop Color="#F0F0F0" Offset="1" />
|
||||
<GradientStop Color="White" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
|
||||
|
||||
|
||||
</ResourceDictionary>
|
||||
41
BrightSharp.NET/BrightSharp.NET/Themes/Theme.Static.cs
Normal file
41
BrightSharp.NET/BrightSharp.NET/Themes/Theme.Static.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace BrightSharp.Themes
|
||||
{
|
||||
|
||||
internal partial class ThemeStatic
|
||||
{
|
||||
public void CalendarPreviewMouseUp(object sender, MouseEventArgs e) {
|
||||
if (Mouse.Captured is CalendarItem) { Mouse.Capture(null); }
|
||||
}
|
||||
public void DatePickerUnloaded(object sender, RoutedEventArgs e) {
|
||||
if (sender == null) return;
|
||||
DependencyObject child = ((Popup)((DatePicker)sender).Template.FindName("PART_Popup", (FrameworkElement)sender))?.Child;
|
||||
while (child != null && !(child is AdornerDecorator))
|
||||
child = VisualTreeHelper.GetParent(child) ?? LogicalTreeHelper.GetParent(child);
|
||||
if (((AdornerDecorator)child)?.Child is Calendar) ((AdornerDecorator)child).Child = null;
|
||||
}
|
||||
|
||||
|
||||
private void closeButton_Click(object sender, RoutedEventArgs e) {
|
||||
var window = Window.GetWindow((DependencyObject)sender);
|
||||
window.Close();
|
||||
}
|
||||
|
||||
private void maximizeButton_Click(object sender, RoutedEventArgs e) {
|
||||
var window = Window.GetWindow((DependencyObject)sender);
|
||||
window.WindowState = window.WindowState == WindowState.Normal ? WindowState.Maximized : WindowState.Normal;
|
||||
}
|
||||
|
||||
private void minimizeButton_Click(object sender, RoutedEventArgs e) {
|
||||
var window = Window.GetWindow((DependencyObject)sender);
|
||||
window.WindowState = WindowState.Minimized;
|
||||
}
|
||||
}
|
||||
}
|
||||
5729
BrightSharp.NET/BrightSharp.NET/Themes/Theme.Static.xaml
Normal file
5729
BrightSharp.NET/BrightSharp.NET/Themes/Theme.Static.xaml
Normal file
File diff suppressed because it is too large
Load Diff
40
BrightSharp.NET/BrightSharp.NET/Themes/Theme.cs
Normal file
40
BrightSharp.NET/BrightSharp.NET/Themes/Theme.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace BrightSharp.Themes
|
||||
{
|
||||
|
||||
internal partial class Theme
|
||||
{
|
||||
public void CalendarPreviewMouseUp(object sender, MouseEventArgs e) {
|
||||
if (Mouse.Captured is CalendarItem) { Mouse.Capture(null); }
|
||||
}
|
||||
public void DatePickerUnloaded(object sender, RoutedEventArgs e) {
|
||||
if (sender == null) return;
|
||||
DependencyObject child = ((Popup)((DatePicker)sender).Template.FindName("PART_Popup", (FrameworkElement)sender))?.Child;
|
||||
while (child != null && !(child is AdornerDecorator))
|
||||
child = VisualTreeHelper.GetParent(child) ?? LogicalTreeHelper.GetParent(child);
|
||||
if (((AdornerDecorator)child)?.Child is Calendar) ((AdornerDecorator)child).Child = null;
|
||||
}
|
||||
|
||||
|
||||
private void closeButton_Click(object sender, RoutedEventArgs e) {
|
||||
var window = Window.GetWindow((DependencyObject)sender);
|
||||
window.Close();
|
||||
}
|
||||
|
||||
private void maximizeButton_Click(object sender, RoutedEventArgs e) {
|
||||
var window = Window.GetWindow((DependencyObject)sender);
|
||||
window.WindowState = window.WindowState == WindowState.Normal ? WindowState.Maximized : WindowState.Normal;
|
||||
}
|
||||
|
||||
private void minimizeButton_Click(object sender, RoutedEventArgs e) {
|
||||
var window = Window.GetWindow((DependencyObject)sender);
|
||||
window.WindowState = WindowState.Minimized;
|
||||
}
|
||||
}
|
||||
}
|
||||
5760
BrightSharp.NET/BrightSharp.NET/Themes/Theme.xaml
Normal file
5760
BrightSharp.NET/BrightSharp.NET/Themes/Theme.xaml
Normal file
File diff suppressed because it is too large
Load Diff
76
BrightSharp.NET/BrightSharp.NET/Themes/ThemeManager.cs
Normal file
76
BrightSharp.NET/BrightSharp.NET/Themes/ThemeManager.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace BrightSharp.Themes
|
||||
{
|
||||
public enum ColorThemes
|
||||
{
|
||||
Classic,
|
||||
DevLab,
|
||||
Silver,
|
||||
Blue,
|
||||
DarkBlue
|
||||
}
|
||||
|
||||
public static class ThemeManager
|
||||
{
|
||||
private const string StyleDictionaryPattern = @"(?<=.+style\.)(.*?)(?=\.xaml)";
|
||||
private const string ThemeDictionaryUri = "/brightsharp;component/themes/theme.xaml";
|
||||
|
||||
private static ColorThemes? ThemeField;
|
||||
|
||||
public static ColorThemes? Theme
|
||||
{
|
||||
get {
|
||||
if (ThemeField.HasValue) return ThemeField.Value;
|
||||
var curStyleRes = Resources.Where(r => r.Source != null &&
|
||||
Regex.IsMatch(r.Source.OriginalString, StyleDictionaryPattern, RegexOptions.IgnoreCase)).FirstOrDefault();
|
||||
if (curStyleRes == null) return null;
|
||||
var match = Regex.Match(curStyleRes.Source.OriginalString, StyleDictionaryPattern, RegexOptions.IgnoreCase);
|
||||
ThemeField = (ColorThemes)Enum.Parse(typeof(ColorThemes), match.Value, true);
|
||||
return ThemeField.Value;
|
||||
}
|
||||
set {
|
||||
_ = SetTheme(value);
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task SetTheme(ColorThemes? value, DispatcherPriority priority = DispatcherPriority.Background)
|
||||
{
|
||||
if (ThemeField == value) { return; }
|
||||
ThemeField = value;
|
||||
await Application.Current.Dispatcher.InvokeAsync(() =>
|
||||
{
|
||||
if (ThemeField != value) return;
|
||||
Application.Current.Resources.BeginInit();
|
||||
|
||||
var curStyleRes = Resources.Where(r => r.Source != null &&
|
||||
Regex.IsMatch(r.Source.OriginalString, StyleDictionaryPattern, RegexOptions.IgnoreCase)).FirstOrDefault();
|
||||
var curThemeRes = Resources.Where(r => r.Source != null && r.Source.OriginalString.Equals(ThemeDictionaryUri, StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault();
|
||||
if (curThemeRes != null)
|
||||
Resources.Remove(curThemeRes);
|
||||
if (curStyleRes != null)
|
||||
Resources.Remove(curStyleRes);
|
||||
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(ThemeDictionaryUri, UriKind.RelativeOrAbsolute) });
|
||||
|
||||
Application.Current.Resources.EndInit();
|
||||
ThemeChanged?.Invoke(null, EventArgs.Empty);
|
||||
}, priority);
|
||||
}
|
||||
|
||||
public static event EventHandler ThemeChanged;
|
||||
|
||||
private static ICollection<ResourceDictionary> Resources
|
||||
{
|
||||
get { return Application.Current.Resources.MergedDictionaries; }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
BIN
BrightSharp.NET/BrightSharp.NET/Themes/icons/app.png
Normal file
BIN
BrightSharp.NET/BrightSharp.NET/Themes/icons/app.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 367 B |
BIN
BrightSharp.NET/BrightSharp.NET/Themes/icons/copy.png
Normal file
BIN
BrightSharp.NET/BrightSharp.NET/Themes/icons/copy.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 503 B |
BIN
BrightSharp.NET/BrightSharp.NET/Themes/icons/cut.png
Normal file
BIN
BrightSharp.NET/BrightSharp.NET/Themes/icons/cut.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 510 B |
BIN
BrightSharp.NET/BrightSharp.NET/Themes/icons/paste.png
Normal file
BIN
BrightSharp.NET/BrightSharp.NET/Themes/icons/paste.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 715 B |
BIN
BrightSharp.NET/BrightSharp.NET/Themes/icons/undo.png
Normal file
BIN
BrightSharp.NET/BrightSharp.NET/Themes/icons/undo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
4
BrightSharp.NET/BrightSharp.NET/packages.config
Normal file
4
BrightSharp.NET/BrightSharp.NET/packages.config
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="System.Windows.Interactivity.WPF" version="2.0.20525" targetFramework="net472" />
|
||||
</packages>
|
||||
74
BrightSharp.NET/BrightSharp.csproj
Normal file
74
BrightSharp.NET/BrightSharp.csproj
Normal file
@@ -0,0 +1,74 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0-windows</TargetFramework>
|
||||
<UseWPF>true</UseWPF>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Themes\icons\app.png" />
|
||||
<None Remove="Themes\icons\copy.png" />
|
||||
<None Remove="Themes\icons\cut.png" />
|
||||
<None Remove="Themes\icons\paste.png" />
|
||||
<None Remove="Themes\icons\undo.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.31" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Resource Include="Themes\icons\app.png" />
|
||||
<Resource Include="Themes\icons\copy.png" />
|
||||
<Resource Include="Themes\icons\cut.png" />
|
||||
<Resource Include="Themes\icons\paste.png" />
|
||||
<Resource Include="Themes\icons\undo.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Diagrams\ZoomControl.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Themes\Theme.cs">
|
||||
<DependentUpon>Theme.xaml</DependentUpon>
|
||||
</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>
|
||||
74
BrightSharp.NET/Commands/AsyncCommand.cs
Normal file
74
BrightSharp.NET/Commands/AsyncCommand.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace BrightSharp.Commands
|
||||
{
|
||||
public class AsyncCommand : ICommand
|
||||
{
|
||||
private readonly Func<object, Task> _execute;
|
||||
private readonly Func<object, bool> _canExecute;
|
||||
private Action _onComplete;
|
||||
private Action<Exception> _onFail;
|
||||
private bool _isExecuting;
|
||||
|
||||
public AsyncCommand(Func<Task> execute) : this(p => execute?.Invoke())
|
||||
{
|
||||
}
|
||||
|
||||
public AsyncCommand(Func<object, Task> execute) : this(execute, o => true)
|
||||
{
|
||||
}
|
||||
|
||||
public AsyncCommand(Func<object, Task> execute, Func<object, bool> canExecute)
|
||||
{
|
||||
_execute = execute;
|
||||
_canExecute = canExecute;
|
||||
}
|
||||
|
||||
public AsyncCommand OnComplete(Action onComplete)
|
||||
{
|
||||
_onComplete = onComplete;
|
||||
return this;
|
||||
}
|
||||
public AsyncCommand OnFail(Action<Exception> onFail)
|
||||
{
|
||||
_onFail = onFail;
|
||||
return this;
|
||||
}
|
||||
|
||||
public bool CanExecute(object parameter)
|
||||
{
|
||||
return !_isExecuting && _canExecute(parameter);
|
||||
}
|
||||
|
||||
public event EventHandler CanExecuteChanged;
|
||||
|
||||
public async void Execute(object parameter)
|
||||
{
|
||||
_isExecuting = true;
|
||||
OnCanExecuteChanged();
|
||||
try
|
||||
{
|
||||
await _execute(parameter);
|
||||
_onComplete?.Invoke();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
while (ex.InnerException != null)
|
||||
ex = ex.InnerException;
|
||||
_onFail?.Invoke(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_isExecuting = false;
|
||||
OnCanExecuteChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void OnCanExecuteChanged()
|
||||
{
|
||||
CanExecuteChanged?.Invoke(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
}
|
||||
71
BrightSharp.NET/Commands/RelayCommand.cs
Normal file
71
BrightSharp.NET/Commands/RelayCommand.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace BrightSharp.Commands
|
||||
{
|
||||
public class RelayCommand : ICommand
|
||||
{
|
||||
private readonly Action _methodToExecute;
|
||||
private readonly Action<object> _methodToExecuteWithParam;
|
||||
private readonly Func<object, bool> _canExecuteEvaluator;
|
||||
|
||||
public event EventHandler CanExecuteChanged
|
||||
{
|
||||
add { CommandManager.RequerySuggested += value; }
|
||||
remove { CommandManager.RequerySuggested -= value; }
|
||||
}
|
||||
|
||||
public RelayCommand(Action<object> methodToExecute, Func<object, bool> canExecuteEvaluator = null)
|
||||
{
|
||||
_methodToExecuteWithParam = methodToExecute;
|
||||
_canExecuteEvaluator = canExecuteEvaluator;
|
||||
}
|
||||
|
||||
public RelayCommand(Action methodToExecute)
|
||||
{
|
||||
_methodToExecute = methodToExecute;
|
||||
}
|
||||
|
||||
public bool CanExecute(object parameter)
|
||||
{
|
||||
if (_canExecuteEvaluator == null)
|
||||
return true;
|
||||
else
|
||||
return _canExecuteEvaluator.Invoke(parameter);
|
||||
}
|
||||
public void Execute(object parameter)
|
||||
{
|
||||
_methodToExecuteWithParam?.Invoke(parameter);
|
||||
_methodToExecute?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
public class RelayCommand<T> : ICommand where T : class
|
||||
{
|
||||
private readonly Action<T> _methodToExecuteWithParam;
|
||||
private readonly Func<T, bool> _canExecuteEvaluator;
|
||||
|
||||
public event EventHandler CanExecuteChanged
|
||||
{
|
||||
add { CommandManager.RequerySuggested += value; }
|
||||
remove { CommandManager.RequerySuggested -= value; }
|
||||
}
|
||||
|
||||
public RelayCommand(Action<T> methodToExecute, Func<T, bool> canExecuteEvaluator = null)
|
||||
{
|
||||
_methodToExecuteWithParam = methodToExecute;
|
||||
_canExecuteEvaluator = canExecuteEvaluator;
|
||||
}
|
||||
|
||||
public bool CanExecute(object parameter)
|
||||
{
|
||||
if (_canExecuteEvaluator == null)
|
||||
return true;
|
||||
return _canExecuteEvaluator.Invoke(parameter as T);
|
||||
}
|
||||
public void Execute(object parameter)
|
||||
{
|
||||
_methodToExecuteWithParam?.Invoke(parameter as T);
|
||||
}
|
||||
}
|
||||
}
|
||||
60
BrightSharp.NET/Converters/IntToValueConverter.cs
Normal file
60
BrightSharp.NET/Converters/IntToValueConverter.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace BrightSharp.Converters
|
||||
{
|
||||
public class IntToValueConverter : IValueConverter
|
||||
{
|
||||
public ulong? TrueValueInt { get; set; } = null;
|
||||
public ulong? FalseValueInt { get; set; } = 0;
|
||||
|
||||
|
||||
public object TrueValue { get; set; } = true;
|
||||
public object FalseValue { get; set; } = false;
|
||||
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
value = false;
|
||||
}
|
||||
if (value is string valueStr)
|
||||
{
|
||||
value = valueStr.Length > 0;
|
||||
}
|
||||
if (value is bool valueBool)
|
||||
{
|
||||
value = valueBool ? 1 : 0;
|
||||
}
|
||||
if (value is ICollection valueCol)
|
||||
{
|
||||
value = valueCol.Count;
|
||||
}
|
||||
if (value is Enum en)
|
||||
{
|
||||
value = System.Convert.ToInt32(en);
|
||||
}
|
||||
if (ulong.TryParse(value.ToString(), out ulong valueLong))
|
||||
{
|
||||
// Exact match for false
|
||||
if (FalseValueInt.HasValue && FalseValueInt == valueLong) return FalseValue;
|
||||
// Exact match for true
|
||||
if (TrueValueInt.HasValue && TrueValueInt == valueLong) return TrueValue;
|
||||
// Any value for false
|
||||
if (!FalseValueInt.HasValue) return FalseValue;
|
||||
// Any value for true
|
||||
if (!TrueValueInt.HasValue) return TrueValue;
|
||||
}
|
||||
return TrueValue;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
// Convert with potential lose exact value match
|
||||
return Equals(value, TrueValue) ? TrueValueInt : FalseValueInt;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace BrightSharp.Converters
|
||||
{
|
||||
[Localizability(LocalizationCategory.NeverLocalize)]
|
||||
public class InverseBooleanToVisibilityConverter : IValueConverter
|
||||
{
|
||||
private BooleanToVisibilityConverter _converter = new BooleanToVisibilityConverter();
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
|
||||
var result = _converter.Convert(value, targetType, parameter, culture) as Visibility?;
|
||||
return result == Visibility.Collapsed ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
|
||||
var result = _converter.ConvertBack(value, targetType, parameter, culture) as bool?;
|
||||
return result == true ? false : true;
|
||||
}
|
||||
}
|
||||
}
|
||||
40
BrightSharp.NET/Converters/ThicknessConverter.cs
Normal file
40
BrightSharp.NET/Converters/ThicknessConverter.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace BrightSharp.Converters
|
||||
{
|
||||
internal class ThicknessConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if(value is Thickness)
|
||||
{
|
||||
var offset = double.Parse(parameter.ToString(), CultureInfo.InvariantCulture.NumberFormat);
|
||||
var thick = (Thickness)value;
|
||||
|
||||
return new Thickness(Math.Max(0, thick.Left + offset),
|
||||
Math.Max(0, thick.Top + offset),
|
||||
Math.Max(0, thick.Right + offset),
|
||||
Math.Max(0, thick.Bottom + offset));
|
||||
}
|
||||
else if(value is CornerRadius)
|
||||
{
|
||||
var offset = double.Parse(parameter.ToString(), CultureInfo.InvariantCulture.NumberFormat);
|
||||
var thick = (CornerRadius)value;
|
||||
|
||||
return new CornerRadius(Math.Max(0, thick.TopLeft + offset),
|
||||
Math.Max(0, thick.TopRight + offset),
|
||||
Math.Max(0, thick.BottomRight + offset),
|
||||
Math.Max(0, thick.BottomLeft + offset));
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
48
BrightSharp.NET/Diagrams/Adorners/ResizeRotateAdorner.cs
Normal file
48
BrightSharp.NET/Diagrams/Adorners/ResizeRotateAdorner.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace BrightSharp.Diagrams
|
||||
{
|
||||
[ToolboxItem(false)]
|
||||
public class ResizeRotateAdorner : Adorner
|
||||
{
|
||||
private VisualCollection visuals;
|
||||
private ResizeRotateChrome chrome;
|
||||
|
||||
protected override int VisualChildrenCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return visuals.Count;
|
||||
}
|
||||
}
|
||||
|
||||
public ResizeRotateAdorner(ContentControl designerItem)
|
||||
: base(designerItem)
|
||||
{
|
||||
SnapsToDevicePixels = true;
|
||||
chrome = new ResizeRotateChrome();
|
||||
chrome.DataContext = designerItem;
|
||||
visuals = new VisualCollection(this);
|
||||
visuals.Add(chrome);
|
||||
Focusable = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected override Size ArrangeOverride(Size arrangeBounds)
|
||||
{
|
||||
chrome.Arrange(new Rect(arrangeBounds));
|
||||
return arrangeBounds;
|
||||
}
|
||||
|
||||
protected override Visual GetVisualChild(int index)
|
||||
{
|
||||
return visuals[index];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
15
BrightSharp.NET/Diagrams/Adorners/ResizeRotateChrome.cs
Normal file
15
BrightSharp.NET/Diagrams/Adorners/ResizeRotateChrome.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace BrightSharp.Diagrams
|
||||
{
|
||||
[ToolboxItem(false)]
|
||||
public class ResizeRotateChrome : Control
|
||||
{
|
||||
static ResizeRotateChrome()
|
||||
{
|
||||
FrameworkElement.DefaultStyleKeyProperty.OverrideMetadata(typeof(ResizeRotateChrome), new FrameworkPropertyMetadata(typeof(ResizeRotateChrome)));
|
||||
}
|
||||
}
|
||||
}
|
||||
46
BrightSharp.NET/Diagrams/Adorners/SizeAdorner.cs
Normal file
46
BrightSharp.NET/Diagrams/Adorners/SizeAdorner.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace BrightSharp.Diagrams
|
||||
{
|
||||
[ToolboxItem(false)]
|
||||
public class SizeAdorner : Adorner
|
||||
{
|
||||
private SizeChrome chrome;
|
||||
private VisualCollection visuals;
|
||||
private FrameworkElement designerItem;
|
||||
|
||||
protected override int VisualChildrenCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return visuals.Count;
|
||||
}
|
||||
}
|
||||
|
||||
public SizeAdorner(FrameworkElement designerItem)
|
||||
: base(designerItem)
|
||||
{
|
||||
SnapsToDevicePixels = true;
|
||||
this.designerItem = designerItem;
|
||||
chrome = new SizeChrome();
|
||||
chrome.DataContext = designerItem;
|
||||
visuals = new VisualCollection(this);
|
||||
visuals.Add(chrome);
|
||||
}
|
||||
|
||||
protected override Visual GetVisualChild(int index)
|
||||
{
|
||||
return visuals[index];
|
||||
}
|
||||
|
||||
protected override Size ArrangeOverride(Size arrangeBounds)
|
||||
{
|
||||
chrome.Arrange(new Rect(new Point(0.0, 0.0), arrangeBounds));
|
||||
return arrangeBounds;
|
||||
}
|
||||
}
|
||||
}
|
||||
34
BrightSharp.NET/Diagrams/Adorners/SizeChrome.cs
Normal file
34
BrightSharp.NET/Diagrams/Adorners/SizeChrome.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace BrightSharp.Diagrams
|
||||
{
|
||||
|
||||
[ToolboxItem(false)]
|
||||
public class SizeChrome : Control
|
||||
{
|
||||
static SizeChrome()
|
||||
{
|
||||
DefaultStyleKeyProperty.OverrideMetadata(typeof(SizeChrome), new FrameworkPropertyMetadata(typeof(SizeChrome)));
|
||||
}
|
||||
}
|
||||
|
||||
public class DoubleFormatConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
double d = (double)value;
|
||||
if (double.IsNaN(d)) return "(Auto)";
|
||||
return Math.Round(d);
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
103
BrightSharp.NET/Diagrams/DesignerItemDecorator.cs
Normal file
103
BrightSharp.NET/Diagrams/DesignerItemDecorator.cs
Normal file
@@ -0,0 +1,103 @@
|
||||
using System;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Animation;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace BrightSharp.Diagrams
|
||||
{
|
||||
[ToolboxItem(false)]
|
||||
public class DesignerItemDecorator : Control
|
||||
{
|
||||
private Adorner adorner;
|
||||
|
||||
public bool ShowDecorator
|
||||
{
|
||||
get { return (bool)GetValue(ShowDecoratorProperty); }
|
||||
set { SetValue(ShowDecoratorProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty ShowDecoratorProperty =
|
||||
DependencyProperty.Register("ShowDecorator", typeof(bool), typeof(DesignerItemDecorator),
|
||||
new FrameworkPropertyMetadata(false, new PropertyChangedCallback(ShowDecoratorProperty_Changed)));
|
||||
|
||||
public DesignerItemDecorator()
|
||||
{
|
||||
Unloaded += new RoutedEventHandler(DesignerItemDecorator_Unloaded);
|
||||
}
|
||||
|
||||
private void HideAdorner()
|
||||
{
|
||||
if (adorner != null)
|
||||
{
|
||||
adorner.Visibility = Visibility.Hidden;
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowAdorner()
|
||||
{
|
||||
if (adorner == null)
|
||||
{
|
||||
AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this);
|
||||
|
||||
if (adornerLayer != null)
|
||||
{
|
||||
ContentControl designerItem = DataContext as ContentControl;
|
||||
Canvas canvas = VisualTreeHelper.GetParent(designerItem) as Canvas;
|
||||
adorner = new ResizeRotateAdorner(designerItem);
|
||||
adornerLayer.Add(adorner);
|
||||
|
||||
if (ShowDecorator)
|
||||
{
|
||||
adorner.Visibility = Visibility.Visible;
|
||||
|
||||
var anim = new DoubleAnimation(0, 1, TimeSpan.FromSeconds(.2));
|
||||
adorner.BeginAnimation(OpacityProperty, anim);
|
||||
}
|
||||
else
|
||||
{
|
||||
adorner.Visibility = Visibility.Hidden;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
adorner.Visibility = Visibility.Visible;
|
||||
|
||||
var anim = new DoubleAnimation(0, 1, TimeSpan.FromSeconds(.2));
|
||||
adorner.BeginAnimation(OpacityProperty, anim);
|
||||
}
|
||||
}
|
||||
|
||||
private void DesignerItemDecorator_Unloaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (adorner != null)
|
||||
{
|
||||
AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this);
|
||||
if (adornerLayer != null)
|
||||
{
|
||||
adornerLayer.Remove(adorner);
|
||||
}
|
||||
|
||||
adorner = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static void ShowDecoratorProperty_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
DesignerItemDecorator decorator = (DesignerItemDecorator)d;
|
||||
bool showDecorator = (bool)e.NewValue;
|
||||
|
||||
if (showDecorator)
|
||||
{
|
||||
decorator.ShowAdorner();
|
||||
}
|
||||
else
|
||||
{
|
||||
decorator.HideAdorner();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
96
BrightSharp.NET/Diagrams/SelectionBehavior.cs
Normal file
96
BrightSharp.NET/Diagrams/SelectionBehavior.cs
Normal file
@@ -0,0 +1,96 @@
|
||||
using BrightSharp.Extensions;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
|
||||
namespace BrightSharp.Diagrams
|
||||
{
|
||||
public static class SelectionBehavior
|
||||
{
|
||||
public static void Attach(FrameworkElement fe)
|
||||
{
|
||||
FrameworkElement selectedControl = null;
|
||||
Style designerStyle = (Style)Application.Current.FindResource("DesignerItemStyle");
|
||||
if (fe is Panel)
|
||||
{
|
||||
var fePanel = (Panel)fe;
|
||||
fe.PreviewMouseLeftButtonDown += (s, e) =>
|
||||
{
|
||||
if (e.Source is DependencyObject)
|
||||
{
|
||||
var clickedElement = ((DependencyObject)e.OriginalSource).GetAncestors<ContentControl>().FirstOrDefault(el => el.Style == designerStyle && WpfExtensions.GetItemsPanel(el.GetParent(true)) == fe);
|
||||
if (clickedElement == null)
|
||||
{
|
||||
foreach (DependencyObject item in fePanel.Children)
|
||||
{
|
||||
Selector.SetIsSelected(item, false);
|
||||
}
|
||||
selectedControl = null;
|
||||
return;
|
||||
}
|
||||
foreach (var control in fePanel.Children.OfType<FrameworkElement>())
|
||||
{
|
||||
if (ProcessControl(control, clickedElement, ref selectedControl))
|
||||
{
|
||||
if (selectedControl is ContentControl cc && cc.Content is ButtonBase)
|
||||
{
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
else if (fe is ItemsControl)
|
||||
{
|
||||
var feItemsControl = (ItemsControl)fe;
|
||||
fe.PreviewMouseLeftButtonDown += (s, e) =>
|
||||
{
|
||||
if (e.Source is DependencyObject)
|
||||
{
|
||||
var clickedElement = ((DependencyObject)e.Source).GetAncestors<ContentControl>().FirstOrDefault(el => el.Style == designerStyle && el.Parent == fe);
|
||||
if (clickedElement == null)
|
||||
{
|
||||
foreach (DependencyObject item in feItemsControl.Items)
|
||||
{
|
||||
Selector.SetIsSelected(item, false);
|
||||
}
|
||||
selectedControl = null;
|
||||
return;
|
||||
}
|
||||
foreach (var control in feItemsControl.Items.OfType<FrameworkElement>())
|
||||
{
|
||||
if (ProcessControl(control, clickedElement, ref selectedControl))
|
||||
{
|
||||
if (selectedControl is ContentControl cc && cc.Content is ButtonBase)
|
||||
{
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private static bool ProcessControl(FrameworkElement control, FrameworkElement clickedElement, ref FrameworkElement selectedControl)
|
||||
{
|
||||
if (control == clickedElement && control != selectedControl)
|
||||
{
|
||||
if (selectedControl != null)
|
||||
{
|
||||
Selector.SetIsSelected(selectedControl, false);
|
||||
}
|
||||
Selector.SetIsSelected(control, true);
|
||||
selectedControl = control;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
75
BrightSharp.NET/Diagrams/Thumbs/MoveThumb.cs
Normal file
75
BrightSharp.NET/Diagrams/Thumbs/MoveThumb.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace BrightSharp.Diagrams
|
||||
{
|
||||
[ToolboxItem(false)]
|
||||
public class MoveThumb : Thumb
|
||||
{
|
||||
private RotateTransform rotateTransform;
|
||||
private FrameworkElement designerItem;
|
||||
private static int? zIndex = null;
|
||||
|
||||
public MoveThumb()
|
||||
{
|
||||
DragStarted += MoveThumb_DragStarted;
|
||||
DragDelta += MoveThumb_DragDelta;
|
||||
DragCompleted += MoveThumb_DragCompleted;
|
||||
}
|
||||
|
||||
private void MoveThumb_DragCompleted(object sender, DragCompletedEventArgs e)
|
||||
{
|
||||
//TODO Need think about ZIndex changes
|
||||
}
|
||||
|
||||
private void MoveThumb_DragStarted(object sender, DragStartedEventArgs e)
|
||||
{
|
||||
designerItem = DataContext as FrameworkElement;
|
||||
|
||||
if (designerItem != null)
|
||||
{
|
||||
rotateTransform = designerItem.RenderTransform as RotateTransform;
|
||||
if (designerItem.GetBindingExpression(Panel.ZIndexProperty) == null)
|
||||
{
|
||||
zIndex = Math.Max(zIndex ?? 0, Panel.GetZIndex(designerItem));
|
||||
Panel.SetZIndex(designerItem, zIndex.Value + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void MoveThumb_DragDelta(object sender, DragDeltaEventArgs e)
|
||||
{
|
||||
if (designerItem != null)
|
||||
{
|
||||
Point dragDelta = new Point(e.HorizontalChange, e.VerticalChange);
|
||||
|
||||
double gridSize = 0;
|
||||
|
||||
var zoomControl = designerItem.Parent as ZoomControl;
|
||||
if (zoomControl != null) gridSize = zoomControl.GridSize;
|
||||
|
||||
if (rotateTransform != null)
|
||||
{
|
||||
dragDelta = rotateTransform.Transform(dragDelta);
|
||||
}
|
||||
if (double.IsNaN(Canvas.GetLeft(designerItem))) Canvas.SetLeft(designerItem, 0);
|
||||
if (double.IsNaN(Canvas.GetTop(designerItem))) Canvas.SetTop(designerItem, 0);
|
||||
|
||||
var newLeft = Canvas.GetLeft(designerItem) + dragDelta.X;
|
||||
var newTop = Canvas.GetTop(designerItem) + dragDelta.Y;
|
||||
if (gridSize > 0)
|
||||
{
|
||||
newLeft = Math.Truncate(newLeft / gridSize) * gridSize;
|
||||
newTop = Math.Truncate(newTop / gridSize) * gridSize;
|
||||
}
|
||||
Canvas.SetLeft(designerItem, newLeft);
|
||||
Canvas.SetTop(designerItem, newTop);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
160
BrightSharp.NET/Diagrams/Thumbs/ResizeThumb.cs
Normal file
160
BrightSharp.NET/Diagrams/Thumbs/ResizeThumb.cs
Normal file
@@ -0,0 +1,160 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Input;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace BrightSharp.Diagrams
|
||||
{
|
||||
[ToolboxItem(false)]
|
||||
public class ResizeThumb : Thumb
|
||||
{
|
||||
private RotateTransform rotateTransform;
|
||||
private double angle;
|
||||
private Adorner adorner;
|
||||
private Point transformOrigin;
|
||||
private FrameworkElement designerItem;
|
||||
private FrameworkElement canvas;
|
||||
|
||||
public ResizeThumb()
|
||||
{
|
||||
DragStarted += new DragStartedEventHandler(ResizeThumb_DragStarted);
|
||||
DragDelta += new DragDeltaEventHandler(ResizeThumb_DragDelta);
|
||||
DragCompleted += new DragCompletedEventHandler(ResizeThumb_DragCompleted);
|
||||
MouseRightButtonDown += new MouseButtonEventHandler(ResizeThumb_MouseRightButtonDown);
|
||||
}
|
||||
|
||||
private void ResizeThumb_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
designerItem = designerItem ?? DataContext as FrameworkElement;
|
||||
|
||||
if (VerticalAlignment == VerticalAlignment.Top || VerticalAlignment == VerticalAlignment.Bottom)
|
||||
{
|
||||
designerItem.Height = double.NaN;
|
||||
}
|
||||
if (HorizontalAlignment == HorizontalAlignment.Left || HorizontalAlignment == HorizontalAlignment.Right)
|
||||
{
|
||||
designerItem.Width = double.NaN;
|
||||
}
|
||||
}
|
||||
|
||||
private void ResizeThumb_DragStarted(object sender, DragStartedEventArgs e)
|
||||
{
|
||||
designerItem = DataContext as ContentControl;
|
||||
|
||||
if (designerItem != null)
|
||||
{
|
||||
canvas = VisualTreeHelper.GetParent(designerItem) as FrameworkElement;
|
||||
|
||||
if (canvas != null)
|
||||
{
|
||||
transformOrigin = designerItem.RenderTransformOrigin;
|
||||
|
||||
rotateTransform = designerItem.RenderTransform as RotateTransform;
|
||||
if (rotateTransform != null)
|
||||
{
|
||||
angle = rotateTransform.Angle * Math.PI / 180.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
angle = 0.0d;
|
||||
}
|
||||
|
||||
AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(canvas);
|
||||
if (adornerLayer != null)
|
||||
{
|
||||
adorner = new SizeAdorner(designerItem);
|
||||
adornerLayer.Add(adorner);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ResizeThumb_DragDelta(object sender, DragDeltaEventArgs e)
|
||||
{
|
||||
if (designerItem != null)
|
||||
{
|
||||
double deltaVertical, deltaHorizontal;
|
||||
if (double.IsNaN(Canvas.GetTop(designerItem))) Canvas.SetTop(designerItem, 0);
|
||||
if (double.IsNaN(Canvas.GetLeft(designerItem))) Canvas.SetLeft(designerItem, 0);
|
||||
if ((VerticalAlignment == VerticalAlignment.Top || VerticalAlignment == VerticalAlignment.Bottom) && double.IsNaN(designerItem.Height)) designerItem.Height = designerItem.ActualHeight;
|
||||
if ((HorizontalAlignment == HorizontalAlignment.Left || HorizontalAlignment == HorizontalAlignment.Right) && double.IsNaN(designerItem.Width)) designerItem.Width = designerItem.ActualWidth;
|
||||
|
||||
var zoomControl = designerItem.Parent as dynamic;
|
||||
double.TryParse(zoomControl.Tag as string, out var gridSize);
|
||||
|
||||
var verticalChange = e.VerticalChange;
|
||||
var horizontalChange = e.HorizontalChange;
|
||||
|
||||
if (gridSize > 0)
|
||||
{
|
||||
verticalChange = Math.Truncate(verticalChange / gridSize) * gridSize;
|
||||
horizontalChange = Math.Truncate(horizontalChange / gridSize) * gridSize;
|
||||
}
|
||||
if (verticalChange != 0)
|
||||
{
|
||||
switch (VerticalAlignment)
|
||||
{
|
||||
case System.Windows.VerticalAlignment.Bottom:
|
||||
deltaVertical = Math.Min(-verticalChange, designerItem.ActualHeight - designerItem.MinHeight);
|
||||
deltaVertical = Math.Max(deltaVertical, designerItem.ActualHeight - designerItem.MaxHeight);
|
||||
Canvas.SetTop(designerItem, Canvas.GetTop(designerItem) + (transformOrigin.Y * deltaVertical * (1 - Math.Cos(-angle))));
|
||||
Canvas.SetLeft(designerItem, Canvas.GetLeft(designerItem) - deltaVertical * transformOrigin.Y * Math.Sin(-angle));
|
||||
designerItem.Height -= deltaVertical;
|
||||
break;
|
||||
case System.Windows.VerticalAlignment.Top:
|
||||
deltaVertical = Math.Min(verticalChange, designerItem.ActualHeight - designerItem.MinHeight);
|
||||
deltaVertical = Math.Max(deltaVertical, designerItem.ActualHeight - designerItem.MaxHeight);
|
||||
Canvas.SetTop(designerItem, Canvas.GetTop(designerItem) + deltaVertical * Math.Cos(-angle) + (transformOrigin.Y * deltaVertical * (1 - Math.Cos(-angle))));
|
||||
Canvas.SetLeft(designerItem, Canvas.GetLeft(designerItem) + deltaVertical * Math.Sin(-angle) - (transformOrigin.Y * deltaVertical * Math.Sin(-angle)));
|
||||
designerItem.Height -= deltaVertical;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (horizontalChange != 0)
|
||||
{
|
||||
switch (HorizontalAlignment)
|
||||
{
|
||||
case System.Windows.HorizontalAlignment.Left:
|
||||
deltaHorizontal = Math.Min(horizontalChange, designerItem.ActualWidth - designerItem.MinWidth);
|
||||
deltaHorizontal = Math.Max(deltaHorizontal, designerItem.ActualWidth - designerItem.MaxWidth);
|
||||
Canvas.SetTop(designerItem, Canvas.GetTop(designerItem) + deltaHorizontal * Math.Sin(angle) - transformOrigin.X * deltaHorizontal * Math.Sin(angle));
|
||||
Canvas.SetLeft(designerItem, Canvas.GetLeft(designerItem) + deltaHorizontal * Math.Cos(angle) + (transformOrigin.X * deltaHorizontal * (1 - Math.Cos(angle))));
|
||||
designerItem.Width -= deltaHorizontal;
|
||||
break;
|
||||
case System.Windows.HorizontalAlignment.Right:
|
||||
deltaHorizontal = Math.Min(-horizontalChange, designerItem.ActualWidth - designerItem.MinWidth);
|
||||
deltaHorizontal = Math.Max(deltaHorizontal, designerItem.ActualWidth - designerItem.MaxWidth);
|
||||
Canvas.SetTop(designerItem, Canvas.GetTop(designerItem) - transformOrigin.X * deltaHorizontal * Math.Sin(angle));
|
||||
Canvas.SetLeft(designerItem, Canvas.GetLeft(designerItem) + (deltaHorizontal * transformOrigin.X * (1 - Math.Cos(angle))));
|
||||
designerItem.Width -= deltaHorizontal;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void ResizeThumb_DragCompleted(object sender, DragCompletedEventArgs e)
|
||||
{
|
||||
if (adorner != null)
|
||||
{
|
||||
AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(canvas);
|
||||
if (adornerLayer != null)
|
||||
{
|
||||
adornerLayer.Remove(adorner);
|
||||
}
|
||||
|
||||
adorner = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
88
BrightSharp.NET/Diagrams/Thumbs/RotateThumb.cs
Normal file
88
BrightSharp.NET/Diagrams/Thumbs/RotateThumb.cs
Normal file
@@ -0,0 +1,88 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace BrightSharp.Diagrams
|
||||
{
|
||||
[ToolboxItem(false)]
|
||||
public class RotateThumb : Thumb
|
||||
{
|
||||
private double initialAngle;
|
||||
private RotateTransform rotateTransform;
|
||||
private Vector startVector;
|
||||
private Point centerPoint;
|
||||
private ContentControl designerItem;
|
||||
private Canvas canvas;
|
||||
|
||||
public RotateThumb()
|
||||
{
|
||||
DragDelta += new DragDeltaEventHandler(RotateThumb_DragDelta);
|
||||
DragStarted += new DragStartedEventHandler(RotateThumb_DragStarted);
|
||||
MouseRightButtonDown += RotateThumb_MouseLeftButtonDown;
|
||||
}
|
||||
|
||||
private void RotateThumb_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (e.RightButton == MouseButtonState.Pressed)
|
||||
{
|
||||
rotateTransform = designerItem.RenderTransform as RotateTransform;
|
||||
if (rotateTransform != null)
|
||||
{
|
||||
rotateTransform.Angle = 0;
|
||||
designerItem.InvalidateMeasure();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void RotateThumb_DragStarted(object sender, DragStartedEventArgs e)
|
||||
{
|
||||
designerItem = DataContext as ContentControl;
|
||||
|
||||
if (designerItem != null)
|
||||
{
|
||||
canvas = VisualTreeHelper.GetParent(designerItem) as Canvas;
|
||||
|
||||
if (canvas != null)
|
||||
{
|
||||
centerPoint = designerItem.TranslatePoint(
|
||||
new Point(designerItem.ActualWidth * designerItem.RenderTransformOrigin.X,
|
||||
designerItem.ActualHeight * designerItem.RenderTransformOrigin.Y),
|
||||
canvas);
|
||||
|
||||
Point startPoint = Mouse.GetPosition(canvas);
|
||||
startVector = Point.Subtract(startPoint, centerPoint);
|
||||
|
||||
rotateTransform = designerItem.RenderTransform as RotateTransform;
|
||||
if (rotateTransform == null)
|
||||
{
|
||||
designerItem.RenderTransform = new RotateTransform(0);
|
||||
initialAngle = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
initialAngle = rotateTransform.Angle;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void RotateThumb_DragDelta(object sender, DragDeltaEventArgs e)
|
||||
{
|
||||
if (designerItem != null && canvas != null)
|
||||
{
|
||||
Point currentPoint = Mouse.GetPosition(canvas);
|
||||
Vector deltaVector = Point.Subtract(currentPoint, centerPoint);
|
||||
|
||||
double angle = Vector.AngleBetween(startVector, deltaVector);
|
||||
|
||||
RotateTransform rotateTransform = designerItem.RenderTransform as RotateTransform;
|
||||
rotateTransform.Angle = initialAngle + Math.Round(angle, 0);
|
||||
designerItem.InvalidateMeasure();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
132
BrightSharp.NET/Diagrams/VisualExtensions.cs
Normal file
132
BrightSharp.NET/Diagrams/VisualExtensions.cs
Normal file
@@ -0,0 +1,132 @@
|
||||
using BrightSharp.Extensions;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Animation;
|
||||
|
||||
namespace BrightSharp.Diagrams
|
||||
{
|
||||
/// <summary>
|
||||
/// If starts with a(A) then use animation,
|
||||
/// $FromZoom-$ToZoom pattern
|
||||
/// </summary>
|
||||
public class VisualExtensions : DependencyObject
|
||||
{
|
||||
#region LevelOfDetails Attached Property
|
||||
|
||||
public static readonly DependencyProperty LODZoomProperty =
|
||||
DependencyProperty.RegisterAttached("LODZoom",
|
||||
typeof(string),
|
||||
typeof(VisualExtensions),
|
||||
new UIPropertyMetadata(null, OnChangeLODZoomProperty));
|
||||
|
||||
public static void SetLODZoom(UIElement element, string o)
|
||||
{
|
||||
element.SetValue(LODZoomProperty, o);
|
||||
}
|
||||
|
||||
public static string GetLODZoom(UIElement element)
|
||||
{
|
||||
return (string)element.GetValue(LODZoomProperty);
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static bool GetCanRotate(DependencyObject obj) {
|
||||
return (bool)obj.GetValue(CanRotateProperty);
|
||||
}
|
||||
|
||||
public static void SetCanRotate(DependencyObject obj, bool value) {
|
||||
obj.SetValue(CanRotateProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty CanRotateProperty =
|
||||
DependencyProperty.RegisterAttached("CanRotate", typeof(bool), typeof(VisualExtensions), new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.Inherits));
|
||||
|
||||
private static void OnChangeLODZoomProperty(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var element = d as FrameworkElement;
|
||||
if (element == null) return;
|
||||
|
||||
var window = Window.GetWindow(element);
|
||||
if (window == null) return;
|
||||
|
||||
if (e.NewValue != e.OldValue)
|
||||
{
|
||||
var zoomControl = element.FindAncestor<ZoomControl>();
|
||||
if (zoomControl == null) return;
|
||||
|
||||
var zoomChangedHandler = new RoutedEventHandler((sender, args) =>
|
||||
{
|
||||
try {
|
||||
ChangeVisibility(args, element, window);
|
||||
}
|
||||
catch (Exception) {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if (string.IsNullOrWhiteSpace((string)e.NewValue))
|
||||
{
|
||||
element.Opacity = 1;
|
||||
zoomControl.ZoomChanged -= zoomChangedHandler;
|
||||
zoomControl.Loaded -= zoomChangedHandler;
|
||||
}
|
||||
else
|
||||
{
|
||||
zoomControl.ZoomChanged += zoomChangedHandler;
|
||||
zoomControl.Loaded += zoomChangedHandler;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void ChangeVisibility(RoutedEventArgs args, FrameworkElement element, Window window) {
|
||||
var lodInfo = new LodInfo(GetLODZoom(element));
|
||||
|
||||
var transform = element.TransformToVisual(window) as MatrixTransform;
|
||||
var scaleX = transform.Matrix.M11;
|
||||
|
||||
var newOpacity = (scaleX >= lodInfo.StartRange && scaleX <= lodInfo.EndRange) ? 1 : 0;
|
||||
|
||||
if (lodInfo.UseAnimation && args.RoutedEvent != FrameworkElement.LoadedEvent) {
|
||||
element.Visibility = Visibility.Visible;
|
||||
var animation = new DoubleAnimation(newOpacity, TimeSpan.FromSeconds(.5));
|
||||
element.BeginAnimation(UIElement.OpacityProperty, animation);
|
||||
}
|
||||
else {
|
||||
element.Visibility = newOpacity == 1 ? Visibility.Visible : Visibility.Hidden;
|
||||
element.Opacity = newOpacity;
|
||||
}
|
||||
}
|
||||
|
||||
sealed class LodInfo
|
||||
{
|
||||
public LodInfo(string lod)
|
||||
{
|
||||
lod = lod.TrimStart();
|
||||
UseAnimation = lod.StartsWith("a", true, CultureInfo.InvariantCulture);
|
||||
lod = lod.TrimStart('a', 'A').Trim();
|
||||
|
||||
double rangeStart = 0;
|
||||
double rangeEnd = double.PositiveInfinity;
|
||||
var vals = lod.Split('-');
|
||||
|
||||
double.TryParse(vals[0], NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out rangeStart);
|
||||
|
||||
if (vals.Length > 1)
|
||||
{
|
||||
if (!double.TryParse(vals[1], NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out rangeEnd))
|
||||
{
|
||||
rangeEnd = double.PositiveInfinity;
|
||||
}
|
||||
}
|
||||
EndRange = rangeEnd;
|
||||
StartRange = rangeStart;
|
||||
}
|
||||
public double StartRange { get; set; }
|
||||
public double EndRange { get; set; }
|
||||
public bool UseAnimation { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
228
BrightSharp.NET/Diagrams/ZoomControl.cs
Normal file
228
BrightSharp.NET/Diagrams/ZoomControl.cs
Normal file
@@ -0,0 +1,228 @@
|
||||
using BrightSharp.Extensions;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media.Animation;
|
||||
|
||||
namespace BrightSharp.Diagrams
|
||||
{
|
||||
|
||||
public partial class ZoomControl : ItemsControl
|
||||
{
|
||||
public ZoomControl()
|
||||
{
|
||||
Loaded += ZoomControl_Loaded;
|
||||
|
||||
}
|
||||
|
||||
private void ZoomControl_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
SelectionBehavior.Attach(this);
|
||||
}
|
||||
|
||||
public ContentControl SelectedControl
|
||||
{
|
||||
get { return (ContentControl)GetValue(SelectedControlProperty); }
|
||||
set { SetValue(SelectedControlProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty SelectedControlProperty =
|
||||
DependencyProperty.Register("SelectedControl", typeof(ContentControl), typeof(ZoomControl), new PropertyMetadata(null));
|
||||
|
||||
protected override void OnPreviewMouseDown(MouseButtonEventArgs e)
|
||||
{
|
||||
base.OnPreviewMouseDown(e);
|
||||
|
||||
if (e.MiddleButton == MouseButtonState.Pressed)
|
||||
{
|
||||
_panPoint = e.GetPosition(this);
|
||||
}
|
||||
}
|
||||
|
||||
private Point? _panPoint;
|
||||
|
||||
#region Props
|
||||
|
||||
public double TranslateX
|
||||
{
|
||||
get { return (double)GetValue(TranslateXProperty); }
|
||||
set { SetValue(TranslateXProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty TranslateXProperty =
|
||||
DependencyProperty.Register("TranslateX", typeof(double), typeof(ZoomControl), new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsArrange, TranslateChangedHandler));
|
||||
|
||||
|
||||
|
||||
public double TranslateY
|
||||
{
|
||||
get { return (double)GetValue(TranslateYProperty); }
|
||||
set { SetValue(TranslateYProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty TranslateYProperty =
|
||||
DependencyProperty.Register("TranslateY", typeof(double), typeof(ZoomControl), new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsArrange, TranslateChangedHandler));
|
||||
|
||||
|
||||
|
||||
public double GridSize
|
||||
{
|
||||
get { return (double)GetValue(GridSizeProperty); }
|
||||
set { SetValue(GridSizeProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty GridSizeProperty =
|
||||
DependencyProperty.Register("GridSize", typeof(double), typeof(ZoomControl), new PropertyMetadata(0.0));
|
||||
|
||||
public double RenderZoom
|
||||
{
|
||||
get { return (double)GetValue(RenderZoomProperty); }
|
||||
set { SetValue(RenderZoomProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty RenderZoomProperty =
|
||||
DependencyProperty.Register("RenderZoom", typeof(double), typeof(ZoomControl), new FrameworkPropertyMetadata(1.0, FrameworkPropertyMetadataOptions.AffectsArrange, ZoomChangedHandler));
|
||||
|
||||
private static void ZoomChangedHandler(DependencyObject d, DependencyPropertyChangedEventArgs baseValue)
|
||||
{
|
||||
ZoomControl zc = (ZoomControl)d;
|
||||
}
|
||||
private static void TranslateChangedHandler(DependencyObject d, DependencyPropertyChangedEventArgs baseValue)
|
||||
{
|
||||
ZoomControl zc = (ZoomControl)d;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private static readonly RoutedEvent ZoomChangedEvent = EventManager.RegisterRoutedEvent("ZoomChanged", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(ZoomControl));
|
||||
|
||||
public event RoutedEventHandler ZoomChanged
|
||||
{
|
||||
add { AddHandler(ZoomChangedEvent, value); }
|
||||
remove { RemoveHandler(ZoomChangedEvent, value); }
|
||||
}
|
||||
|
||||
private void RaiseZoomChangedEvent()
|
||||
{
|
||||
var newEventArgs = new RoutedEventArgs(ZoomChangedEvent);
|
||||
RaiseEvent(newEventArgs);
|
||||
}
|
||||
|
||||
static ZoomControl()
|
||||
{
|
||||
DefaultStyleKeyProperty.OverrideMetadata(typeof(ZoomControl), new FrameworkPropertyMetadata(typeof(ZoomControl)));
|
||||
}
|
||||
|
||||
protected override void OnPreviewMouseWheel(MouseWheelEventArgs e)
|
||||
{
|
||||
if (CheckMouseOverControlWheelHandle(_panPoint.HasValue))
|
||||
return;
|
||||
|
||||
var point = e.GetPosition(this);
|
||||
|
||||
|
||||
var oldValue = RenderZoom;
|
||||
const double zoomPower = 1.25;
|
||||
var newValue = RenderZoom * (e.Delta > 0 ? zoomPower : 1 / zoomPower);
|
||||
if (UseAnimation)
|
||||
{
|
||||
DoubleAnimation anim = new DoubleAnimation(newValue, TimeSpan.FromSeconds(.3));
|
||||
anim.EasingFunction = new SineEase() { EasingMode = EasingMode.EaseInOut };
|
||||
BeginAnimation(ZoomControl.RenderZoomProperty, anim);
|
||||
}
|
||||
else
|
||||
{
|
||||
DoubleAnimation anim = new DoubleAnimation(newValue, TimeSpan.FromSeconds(0));
|
||||
anim.EasingFunction = new SineEase() { EasingMode = EasingMode.EaseInOut };
|
||||
BeginAnimation(ZoomControl.RenderZoomProperty, anim);
|
||||
}
|
||||
|
||||
RaiseZoomChangedEvent();
|
||||
|
||||
var translateXTo = CoercePanTranslate(TranslateX, point.X, oldValue, newValue);
|
||||
var translateYTo = CoercePanTranslate(TranslateY, point.Y, oldValue, newValue);
|
||||
if (UseAnimation)
|
||||
{
|
||||
DoubleAnimation anim = new DoubleAnimation(translateXTo, TimeSpan.FromSeconds(.3));
|
||||
anim.EasingFunction = new SineEase() { EasingMode = EasingMode.EaseInOut };
|
||||
BeginAnimation(ZoomControl.TranslateXProperty, anim);
|
||||
|
||||
anim = new DoubleAnimation(translateYTo, TimeSpan.FromSeconds(.3));
|
||||
anim.EasingFunction = new SineEase() { EasingMode = EasingMode.EaseInOut };
|
||||
BeginAnimation(ZoomControl.TranslateYProperty, anim);
|
||||
}
|
||||
else
|
||||
{
|
||||
DoubleAnimation anim = new DoubleAnimation(translateXTo, TimeSpan.FromSeconds(0));
|
||||
anim.EasingFunction = new SineEase() { EasingMode = EasingMode.EaseInOut };
|
||||
BeginAnimation(ZoomControl.TranslateXProperty, anim);
|
||||
|
||||
anim = new DoubleAnimation(translateYTo, TimeSpan.FromSeconds(0));
|
||||
anim.EasingFunction = new SineEase() { EasingMode = EasingMode.EaseInOut };
|
||||
BeginAnimation(ZoomControl.TranslateYProperty, anim);
|
||||
}
|
||||
|
||||
e.Handled = true;
|
||||
|
||||
base.OnPreviewMouseWheel(e);
|
||||
}
|
||||
public bool UseAnimation { get; set; }
|
||||
private static bool CheckMouseOverControlWheelHandle(bool checkFlowDoc = false)
|
||||
{
|
||||
if (Keyboard.IsKeyDown(Key.LeftCtrl)) return false;
|
||||
var element = Mouse.DirectlyOver as DependencyObject;
|
||||
if (element is ScrollViewer) return true;
|
||||
|
||||
var scrollViewer = element.FindAncestor<ScrollViewer>();
|
||||
if (scrollViewer != null)
|
||||
{
|
||||
return scrollViewer.ComputedVerticalScrollBarVisibility == Visibility.Visible
|
||||
|| scrollViewer.ComputedHorizontalScrollBarVisibility == Visibility.Visible;
|
||||
}
|
||||
if (checkFlowDoc)
|
||||
{
|
||||
var flowDocument = element.FindAncestor<FlowDocument>();
|
||||
if (flowDocument != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static double CoercePanTranslate(double oldTranslate, double mousePos, double oldZoom, double newZoom)
|
||||
{
|
||||
return Math.Round(oldTranslate + (oldTranslate - mousePos) * (newZoom - oldZoom) / oldZoom);
|
||||
}
|
||||
|
||||
protected override void OnMouseUp(MouseButtonEventArgs e)
|
||||
{
|
||||
base.OnMouseUp(e);
|
||||
|
||||
if (e.MiddleButton == MouseButtonState.Released)
|
||||
{
|
||||
_panPoint = null;
|
||||
ReleaseMouseCapture();
|
||||
}
|
||||
}
|
||||
protected override void OnPreviewMouseMove(MouseEventArgs e)
|
||||
{
|
||||
base.OnPreviewMouseMove(e);
|
||||
if (e.MiddleButton == MouseButtonState.Pressed && _panPoint.HasValue)
|
||||
{
|
||||
//PAN MODE
|
||||
var vector = e.GetPosition(this) - _panPoint.Value;
|
||||
_panPoint = _panPoint + vector;
|
||||
CaptureMouse();
|
||||
TranslateX += vector.X;
|
||||
TranslateY += vector.Y;
|
||||
BeginAnimation(TranslateXProperty, null);
|
||||
BeginAnimation(TranslateYProperty, null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
168
BrightSharp.NET/Extensions/MarkupExtensionProperties.cs
Normal file
168
BrightSharp.NET/Extensions/MarkupExtensionProperties.cs
Normal file
@@ -0,0 +1,168 @@
|
||||
using BrightSharp.Behaviors;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace BrightSharp.Extensions
|
||||
{
|
||||
public static class MarkupExtensionProperties
|
||||
{
|
||||
public static CornerRadius GetCornerRadius(DependencyObject obj)
|
||||
{
|
||||
return (CornerRadius)obj.GetValue(CornerRadiusProperty);
|
||||
}
|
||||
public static void SetCornerRadius(DependencyObject obj, CornerRadius value)
|
||||
{
|
||||
obj.SetValue(CornerRadiusProperty, value);
|
||||
}
|
||||
public static object GetHeader(DependencyObject obj)
|
||||
{
|
||||
return obj.GetValue(HeaderProperty);
|
||||
}
|
||||
public static void SetHeader(DependencyObject obj, object value)
|
||||
{
|
||||
obj.SetValue(HeaderProperty, value);
|
||||
}
|
||||
public static object GetLeadingElement(DependencyObject obj)
|
||||
{
|
||||
return obj.GetValue(CornerRadiusProperty);
|
||||
}
|
||||
public static void SetLeadingElement(DependencyObject obj, object value)
|
||||
{
|
||||
obj.SetValue(CornerRadiusProperty, value);
|
||||
}
|
||||
public static object GetTrailingElement(DependencyObject obj)
|
||||
{
|
||||
return obj.GetValue(CornerRadiusProperty);
|
||||
}
|
||||
public static void SetTrailingElement(DependencyObject obj, object value)
|
||||
{
|
||||
obj.SetValue(CornerRadiusProperty, value);
|
||||
}
|
||||
public static object GetIcon(DependencyObject obj)
|
||||
{
|
||||
return obj.GetValue(IconProperty);
|
||||
}
|
||||
public static void SetIcon(DependencyObject obj, object value)
|
||||
{
|
||||
obj.SetValue(IconProperty, value);
|
||||
}
|
||||
public static void SetHeaderHeight(DependencyObject obj, double value)
|
||||
{
|
||||
obj.SetValue(HeaderHeightProperty, value);
|
||||
}
|
||||
public static double GetHeaderHeight(DependencyObject obj)
|
||||
{
|
||||
return (double)obj.GetValue(HeaderHeightProperty);
|
||||
}
|
||||
|
||||
public static void SetHeaderVerticalAlignment(DependencyObject obj, VerticalAlignment value)
|
||||
{
|
||||
obj.SetValue(HeaderVerticalAlignmentProperty, value);
|
||||
}
|
||||
public static VerticalAlignment GetHeaderVerticalAlignment(DependencyObject obj)
|
||||
{
|
||||
return (VerticalAlignment)obj.GetValue(HeaderVerticalAlignmentProperty);
|
||||
}
|
||||
public static void SetHeaderHorizontalAlignment(DependencyObject obj, HorizontalAlignment value)
|
||||
{
|
||||
obj.SetValue(HeaderHorizontalAlignmentProperty, value);
|
||||
}
|
||||
public static HorizontalAlignment GetHeaderHorizontalAlignment(DependencyObject obj)
|
||||
{
|
||||
return (HorizontalAlignment)obj.GetValue(HeaderHorizontalAlignmentProperty);
|
||||
}
|
||||
public static void SetSpecialHeight(DependencyObject obj, double value)
|
||||
{
|
||||
obj.SetValue(SpecialHeightProperty, value);
|
||||
}
|
||||
public static double GetSpecialHeight(DependencyObject obj)
|
||||
{
|
||||
return (double)obj.GetValue(SpecialHeightProperty);
|
||||
}
|
||||
public static void SetSpecialWidth(DependencyObject obj, double value)
|
||||
{
|
||||
obj.SetValue(SpecialWidthProperty, value);
|
||||
}
|
||||
public static double GetSpecialWidth(DependencyObject obj)
|
||||
{
|
||||
return (double)obj.GetValue(SpecialWidthProperty);
|
||||
}
|
||||
public static Dock GetDocking(DependencyObject obj)
|
||||
{
|
||||
return (Dock)obj.GetValue(DockingProperty);
|
||||
}
|
||||
public static void SetDocking(DependencyObject obj, Dock value)
|
||||
{
|
||||
obj.SetValue(DockingProperty, value);
|
||||
}
|
||||
public static Thickness GetHeaderPadding(DependencyObject obj)
|
||||
{
|
||||
return (Thickness)obj.GetValue(HeaderPaddingProperty);
|
||||
}
|
||||
public static void SetHeaderPadding(DependencyObject obj, Thickness value)
|
||||
{
|
||||
obj.SetValue(HeaderPaddingProperty, value);
|
||||
}
|
||||
public static bool GetIsDragHelperVisible(DependencyObject obj)
|
||||
{
|
||||
return (bool)obj.GetValue(IsDragHelperVisibleProperty);
|
||||
}
|
||||
public static void SetIsDragHelperVisible(DependencyObject obj, bool value)
|
||||
{
|
||||
obj.SetValue(IsDragHelperVisibleProperty, value);
|
||||
}
|
||||
public static Brush GetSpecialBrush(DependencyObject obj)
|
||||
{
|
||||
return (Brush)obj.GetValue(SpecialBrushProperty);
|
||||
}
|
||||
public static void SetSpecialBrush(DependencyObject obj, Brush value)
|
||||
{
|
||||
obj.SetValue(SpecialBrushProperty, value);
|
||||
}
|
||||
|
||||
public static bool GetUseMinMaxSizeBehavior(Window obj)
|
||||
{
|
||||
return (bool)obj.GetValue(UseMinMaxSizeBehaviorProperty);
|
||||
}
|
||||
|
||||
public static void SetUseMinMaxSizeBehavior(Window obj, bool value)
|
||||
{
|
||||
obj.SetValue(UseMinMaxSizeBehaviorProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty SpecialBrushProperty = DependencyProperty.RegisterAttached("SpecialBrush", typeof(Brush), typeof(MarkupExtensionProperties), new PropertyMetadata(null));
|
||||
public static readonly DependencyProperty IsDragHelperVisibleProperty = DependencyProperty.RegisterAttached("IsDragHelperVisible", typeof(bool), typeof(MarkupExtensionProperties), new FrameworkPropertyMetadata(true));
|
||||
public static readonly DependencyProperty HeaderPaddingProperty = DependencyProperty.RegisterAttached("HeaderPadding", typeof(Thickness), typeof(MarkupExtensionProperties), new PropertyMetadata(null));
|
||||
public static readonly DependencyProperty CornerRadiusProperty = DependencyProperty.RegisterAttached("CornerRadius", typeof(CornerRadius), typeof(MarkupExtensionProperties), new PropertyMetadata(null));
|
||||
public static readonly DependencyProperty LeadingElementProperty = DependencyProperty.RegisterAttached("LeadingElement", typeof(object), typeof(MarkupExtensionProperties), new PropertyMetadata(null));
|
||||
public static readonly DependencyProperty TrailingElementProperty = DependencyProperty.RegisterAttached("TrailingElement", typeof(object), typeof(MarkupExtensionProperties), new PropertyMetadata(null));
|
||||
public static readonly DependencyProperty HeaderProperty = DependencyProperty.RegisterAttached("Header", typeof(object), typeof(MarkupExtensionProperties), new FrameworkPropertyMetadata(null));
|
||||
public static readonly DependencyProperty DockingProperty = DependencyProperty.RegisterAttached("Docking", typeof(Dock), typeof(MarkupExtensionProperties), new PropertyMetadata(null));
|
||||
public static readonly DependencyProperty IconProperty = DependencyProperty.RegisterAttached("Icon", typeof(object), typeof(MarkupExtensionProperties), new PropertyMetadata(null));
|
||||
public static readonly DependencyProperty HeaderHeightProperty = DependencyProperty.RegisterAttached("HeaderHeight", typeof(double), typeof(MarkupExtensionProperties), new PropertyMetadata(null));
|
||||
public static readonly DependencyProperty HeaderVerticalAlignmentProperty = DependencyProperty.RegisterAttached("HeaderVerticalAlignment", typeof(VerticalAlignment), typeof(MarkupExtensionProperties), new PropertyMetadata(VerticalAlignment.Center));
|
||||
public static readonly DependencyProperty HeaderHorizontalAlignmentProperty = DependencyProperty.RegisterAttached("HeaderHorizontalAlignment", typeof(HorizontalAlignment), typeof(MarkupExtensionProperties), new PropertyMetadata(HorizontalAlignment.Left));
|
||||
public static readonly DependencyProperty SpecialHeightProperty = DependencyProperty.RegisterAttached("SpecialHeight", typeof(double), typeof(MarkupExtensionProperties), new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.Inherits | FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.AffectsMeasure));
|
||||
public static readonly DependencyProperty SpecialWidthProperty = DependencyProperty.RegisterAttached("SpecialWidth", typeof(double), typeof(MarkupExtensionProperties), new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.Inherits | FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.AffectsMeasure));
|
||||
public static readonly DependencyProperty UseMinMaxSizeBehaviorProperty = DependencyProperty.RegisterAttached("UseMinMaxSizeBehavior", typeof(bool), typeof(MarkupExtensionProperties), new PropertyMetadata(false, UseMinMaxSizeBehaviorChanged));
|
||||
|
||||
|
||||
private static void UseMinMaxSizeBehaviorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var window = d as Window;
|
||||
if (window == null) return;
|
||||
if ((bool)e.NewValue)
|
||||
{
|
||||
new MinMaxSize_Logic(window).OnAttached();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Not supported yet
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
142
BrightSharp.NET/Extensions/WpfExtensions.cs
Normal file
142
BrightSharp.NET/Extensions/WpfExtensions.cs
Normal file
@@ -0,0 +1,142 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Media3D;
|
||||
|
||||
namespace BrightSharp.Extensions
|
||||
{
|
||||
public static class WpfExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns Parent item of DependencyObject
|
||||
/// </summary>
|
||||
/// <param name="obj">Child object</param>
|
||||
/// <param name="useLogicalTree">Prefer LogicalTree when need.</param>
|
||||
/// <returns>Found item</returns>
|
||||
public static DependencyObject GetParent(this DependencyObject obj, bool useLogicalTree = false)
|
||||
{
|
||||
if (!useLogicalTree && (obj is Visual || obj is Visual3D))
|
||||
return VisualTreeHelper.GetParent(obj) ?? LogicalTreeHelper.GetParent(obj);
|
||||
else
|
||||
return LogicalTreeHelper.GetParent(obj);
|
||||
}
|
||||
|
||||
public static IEnumerable<T> GetAncestors<T>(this DependencyObject obj, bool useLogicalTree = false) where T : DependencyObject
|
||||
{
|
||||
if (obj == null) yield break;
|
||||
|
||||
var x = GetParent(obj, useLogicalTree);
|
||||
|
||||
while (x != null && !(x is T))
|
||||
{
|
||||
x = GetParent(x, useLogicalTree);
|
||||
}
|
||||
if (x != null)
|
||||
yield return x as T;
|
||||
else
|
||||
yield break;
|
||||
foreach (var item in GetAncestors<T>(x, useLogicalTree))
|
||||
{
|
||||
yield return item;
|
||||
}
|
||||
}
|
||||
|
||||
public static T FindAncestor<T>(this DependencyObject obj) where T : DependencyObject
|
||||
{
|
||||
return GetAncestors<T>(obj).FirstOrDefault();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Try find ItemsPanel of ItemsControl
|
||||
/// </summary>
|
||||
/// <param name="itemsControl">Where to search</param>
|
||||
/// <returns>Panel of ItemsControl</returns>
|
||||
public static Panel GetItemsPanel(DependencyObject itemsControl)
|
||||
{
|
||||
if (itemsControl is Panel) return (Panel)itemsControl;
|
||||
ItemsPresenter itemsPresenter = FindVisualChildren<ItemsPresenter>(itemsControl).FirstOrDefault();
|
||||
if (itemsPresenter == null) return null;
|
||||
var itemsPanel = VisualTreeHelper.GetChild(itemsPresenter, 0) as Panel;
|
||||
return itemsPanel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if object is valid (no errors found in logical children)
|
||||
/// </summary>
|
||||
/// <param name="obj">Object to search</param>
|
||||
/// <returns>True if no errors found</returns>
|
||||
public static bool IsValid(this DependencyObject obj) {
|
||||
if (obj == null) return true;
|
||||
if (Validation.GetHasError(obj)) return false;
|
||||
foreach (var child in LogicalTreeHelper.GetChildren(obj).OfType<DependencyObject>()) {
|
||||
if (child == null) continue;
|
||||
if (child is UIElement ui) {
|
||||
if (!ui.IsVisible || !ui.IsEnabled) continue;
|
||||
}
|
||||
if (!IsValid(child)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Search all textboxes to update invalid with UpdateSource(). For ex. when need update validation messages.
|
||||
/// </summary>
|
||||
/// <param name="obj">Object where to search TextBoxes</param>
|
||||
public static void UpdateSources(this DependencyObject obj) {
|
||||
if (obj == null) return;
|
||||
if (Validation.GetHasError(obj)) {
|
||||
//TODO Any types?
|
||||
if (obj is TextBox tb) tb.GetBindingExpression(TextBox.TextProperty)?.UpdateSource();
|
||||
}
|
||||
foreach (var item in FindLogicalChildren<DependencyObject>(obj)) {
|
||||
UpdateSources(item);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Find all visual children of type T
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type to search</typeparam>
|
||||
/// <param name="depObj">Object where to search</param>
|
||||
/// <returns>Enumerator for items</returns>
|
||||
public static IEnumerable<T> FindVisualChildren<T>(this DependencyObject depObj) where T : DependencyObject {
|
||||
if (depObj != null && (depObj is Visual || depObj is Visual3D)) {
|
||||
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(depObj); i++) {
|
||||
DependencyObject child = VisualTreeHelper.GetChild(depObj, i);
|
||||
if (child != null && child is T) {
|
||||
yield return (T)child;
|
||||
}
|
||||
|
||||
foreach (T childOfChild in FindVisualChildren<T>(child)) {
|
||||
yield return childOfChild;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Find all logical children of type T
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type to search</typeparam>
|
||||
/// <param name="depObj">Object where to search</param>
|
||||
/// <returns>Enumerator for items</returns>
|
||||
public static IEnumerable<T> FindLogicalChildren<T>(this DependencyObject depObj) where T : DependencyObject {
|
||||
if (depObj != null) {
|
||||
foreach (object rawChild in LogicalTreeHelper.GetChildren(depObj)) {
|
||||
if (rawChild is DependencyObject child) {
|
||||
if (child is T) {
|
||||
yield return (T)child;
|
||||
}
|
||||
|
||||
foreach (T childOfChild in FindLogicalChildren<T>(child)) {
|
||||
yield return childOfChild;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
11
BrightSharp.NET/Interop/Constants.cs
Normal file
11
BrightSharp.NET/Interop/Constants.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace BrightSharp.Interop
|
||||
{
|
||||
namespace Constants
|
||||
{
|
||||
internal enum MonitorFromWindowFlags
|
||||
{
|
||||
MONITOR_DEFAULTTONEAREST = 0x00000002
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
20
BrightSharp.NET/Interop/NativeMethods.cs
Normal file
20
BrightSharp.NET/Interop/NativeMethods.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using BrightSharp.Interop.Structures;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace BrightSharp.Interop
|
||||
{
|
||||
internal static class NativeMethods
|
||||
{
|
||||
#region Monitor
|
||||
|
||||
[DllImport("user32.dll", SetLastError = true)]
|
||||
internal static extern bool GetMonitorInfo(IntPtr hMonitor, MONITORINFO lpmi);
|
||||
|
||||
[DllImport("user32.dll", SetLastError = true)]
|
||||
internal static extern IntPtr MonitorFromWindow(IntPtr handle, int flags);
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
130
BrightSharp.NET/Interop/Structures.cs
Normal file
130
BrightSharp.NET/Interop/Structures.cs
Normal file
@@ -0,0 +1,130 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace BrightSharp.Interop
|
||||
{
|
||||
namespace Structures
|
||||
{
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
|
||||
internal class MONITORINFO
|
||||
{
|
||||
public int cbSize = Marshal.SizeOf(typeof(MONITORINFO));
|
||||
|
||||
public RECT rcMonitor;
|
||||
|
||||
public RECT rcWork;
|
||||
|
||||
public int dwFlags;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 0)]
|
||||
internal struct POINT
|
||||
{
|
||||
public int x;
|
||||
public int y;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 0)]
|
||||
internal struct RECT
|
||||
{
|
||||
public int Left;
|
||||
|
||||
public int Top;
|
||||
|
||||
public int Right;
|
||||
|
||||
public int Bottom;
|
||||
|
||||
public static readonly RECT Empty;
|
||||
|
||||
public int Width
|
||||
{
|
||||
get {
|
||||
return Math.Abs(Right - Left);
|
||||
} // Abs needed for BIDI OS
|
||||
}
|
||||
|
||||
public int Height
|
||||
{
|
||||
get {
|
||||
return Bottom - Top;
|
||||
}
|
||||
}
|
||||
|
||||
public RECT(int left, int top, int right, int bottom)
|
||||
{
|
||||
Left = left;
|
||||
Top = top;
|
||||
Right = right;
|
||||
Bottom = bottom;
|
||||
}
|
||||
|
||||
public RECT(RECT rcSrc)
|
||||
{
|
||||
Left = rcSrc.Left;
|
||||
Top = rcSrc.Top;
|
||||
Right = rcSrc.Right;
|
||||
Bottom = rcSrc.Bottom;
|
||||
}
|
||||
|
||||
public bool IsEmpty
|
||||
{
|
||||
get {
|
||||
// BUGBUG : On Bidi OS (hebrew arabic) left > right
|
||||
return Left >= Right || Top >= Bottom;
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
if (this == Empty)
|
||||
{
|
||||
return "RECT {Empty}";
|
||||
}
|
||||
return "RECT { left : " + Left + " / top : " + Top + " / right : " + Right + " / bottom : " +
|
||||
Bottom + " }";
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (!(obj is RECT))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return (this == (RECT)obj);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Left.GetHashCode() + Top.GetHashCode() + Right.GetHashCode() +
|
||||
Bottom.GetHashCode();
|
||||
}
|
||||
|
||||
public static bool operator ==(RECT rect1, RECT rect2)
|
||||
{
|
||||
return (rect1.Left == rect2.Left && rect1.Top == rect2.Top && rect1.Right == rect2.Right &&
|
||||
rect1.Bottom == rect2.Bottom);
|
||||
}
|
||||
|
||||
public static bool operator !=(RECT rect1, RECT rect2)
|
||||
{
|
||||
return !(rect1 == rect2);
|
||||
}
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct MINMAXINFO
|
||||
{
|
||||
public POINT ptReserved;
|
||||
|
||||
public POINT ptMaxSize;
|
||||
|
||||
public POINT ptMaxPosition;
|
||||
|
||||
public POINT ptMinTrackSize;
|
||||
|
||||
public POINT ptMaxTrackSize;
|
||||
};
|
||||
}
|
||||
}
|
||||
63
BrightSharp.NET/Properties/AssemblyInfo.cs
Normal file
63
BrightSharp.NET/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
using System.Windows.Markup;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("BrightSharp")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("BrightSharp")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
//In order to begin building localizable applications, set
|
||||
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
|
||||
//inside a <PropertyGroup>. For example, if you are using US english
|
||||
//in your source files, set the <UICulture> to en-US. Then uncomment
|
||||
//the NeutralResourceLanguage attribute below. Update the "en-US" in
|
||||
//the line below to match the UICulture setting in the project file.
|
||||
|
||||
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||
|
||||
|
||||
[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)
|
||||
)]
|
||||
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("2.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("2.0.0.0")]
|
||||
[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")]
|
||||
63
BrightSharp.NET/Properties/Resources.Designer.cs
generated
Normal file
63
BrightSharp.NET/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace BrightSharp.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BrightSharp.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
117
BrightSharp.NET/Properties/Resources.resx
Normal file
117
BrightSharp.NET/Properties/Resources.resx
Normal file
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
26
BrightSharp.NET/Properties/Settings.Designer.cs
generated
Normal file
26
BrightSharp.NET/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace BrightSharp.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.3.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
7
BrightSharp.NET/Properties/Settings.settings
Normal file
7
BrightSharp.NET/Properties/Settings.settings
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
38
BrightSharp.NET/Themes/Controls/ZoomControl.xaml
Normal file
38
BrightSharp.NET/Themes/Controls/ZoomControl.xaml
Normal file
@@ -0,0 +1,38 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:diag="clr-namespace:BrightSharp.Diagrams">
|
||||
|
||||
<Style TargetType="{x:Type diag:ZoomControl}">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="ClipToBounds" Value="True" />
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
<Setter Property="ItemsPanel">
|
||||
<Setter.Value>
|
||||
<ItemsPanelTemplate>
|
||||
<Canvas Background="Transparent" />
|
||||
</ItemsPanelTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type diag:ZoomControl}">
|
||||
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Margin="{TemplateBinding Padding}">
|
||||
<Grid>
|
||||
<ItemsPresenter>
|
||||
<ItemsPresenter.RenderTransform>
|
||||
<TransformGroup>
|
||||
<ScaleTransform ScaleX="{Binding RenderZoom, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
ScaleY="{Binding ScaleX, RelativeSource={RelativeSource Self}}" />
|
||||
<TranslateTransform X="{Binding TranslateX, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Y="{Binding TranslateY, RelativeSource={RelativeSource TemplatedParent}}" />
|
||||
</TransformGroup>
|
||||
</ItemsPresenter.RenderTransform>
|
||||
</ItemsPresenter>
|
||||
<Border x:Name="PART_SelectionBorder" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
43
BrightSharp.NET/Themes/Diagrams/DesignerItem.xaml
Normal file
43
BrightSharp.NET/Themes/Diagrams/DesignerItem.xaml
Normal file
@@ -0,0 +1,43 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:s="clr-namespace:BrightSharp.Diagrams">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="SizeChrome.xaml"/>
|
||||
<ResourceDictionary Source="ResizeRotateChrome.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<ControlTemplate x:Key="MoveThumbTemplate" TargetType="{x:Type s:MoveThumb}">
|
||||
<Rectangle Fill="Transparent"/>
|
||||
</ControlTemplate>
|
||||
|
||||
<Style x:Key="DesignerItemStyle" TargetType="ContentControl">
|
||||
<Setter Property="MinHeight" Value="26"/>
|
||||
<Setter Property="MinWidth" Value="30"/>
|
||||
<Setter Property="RenderTransformOrigin" Value="0.5,0.5"/>
|
||||
<Setter Property="SnapsToDevicePixels" Value="true"/>
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
<Setter Property="MaxHeight" Value="900" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ContentControl">
|
||||
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
|
||||
<Grid DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}">
|
||||
<s:MoveThumb Focusable="False" Cursor="SizeAll" Template="{StaticResource MoveThumbTemplate}" />
|
||||
<ContentPresenter Content="{TemplateBinding ContentControl.Content}"
|
||||
Margin="{TemplateBinding Padding}"/>
|
||||
<s:DesignerItemDecorator x:Name="ItemDecorator" Focusable="False"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="Selector.IsSelected" Value="True">
|
||||
<Setter TargetName="ItemDecorator" Property="ShowDecorator" Value="True" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
|
||||
</ResourceDictionary>
|
||||
114
BrightSharp.NET/Themes/Diagrams/ResizeRotateChrome.xaml
Normal file
114
BrightSharp.NET/Themes/Diagrams/ResizeRotateChrome.xaml
Normal file
@@ -0,0 +1,114 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:s="clr-namespace:BrightSharp.Diagrams">
|
||||
<BooleanToVisibilityConverter x:Key="btvc" />
|
||||
<Style TargetType="{x:Type Shape}" x:Key="ThumbCorner">
|
||||
<Setter Property="SnapsToDevicePixels" Value="true" />
|
||||
<Setter Property="Stroke" Value="#FF0166AC" />
|
||||
<Setter Property="StrokeThickness" Value="1" />
|
||||
<Setter Property="Width" Value="7" />
|
||||
<Setter Property="Height" Value="7" />
|
||||
<Setter Property="Margin" Value="-2" />
|
||||
<Setter Property="Fill">
|
||||
<Setter.Value>
|
||||
<RadialGradientBrush Center="0.2, 0.2" GradientOrigin="0.2, 0.2" RadiusX="0.8" RadiusY="0.8">
|
||||
<GradientStop Color="White" Offset="0.0" />
|
||||
<GradientStop Color="#FF9AFF9F" Offset="0.8" />
|
||||
</RadialGradientBrush>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type s:ResizeRotateChrome}">
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type s:ResizeRotateChrome}">
|
||||
<Grid>
|
||||
<Grid Opacity="0" Margin="-3">
|
||||
<s:MoveThumb Margin="0,-20,0,0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
Height="16"
|
||||
Width="16"
|
||||
Cursor="SizeAll"
|
||||
Template="{DynamicResource MoveThumbTemplate}" />
|
||||
<s:RotateThumb Width="20"
|
||||
Height="20" Visibility="{Binding Path=DataContext.(s:VisualExtensions.CanRotate), RelativeSource={RelativeSource Self}, Converter={StaticResource btvc}}"
|
||||
Margin="0,-20,0,0"
|
||||
Cursor="Hand"
|
||||
VerticalAlignment="Top"
|
||||
HorizontalAlignment="Center"/>
|
||||
<s:ResizeThumb Height="3"
|
||||
Cursor="SizeNS"
|
||||
VerticalAlignment="Top"
|
||||
HorizontalAlignment="Stretch"/>
|
||||
<s:ResizeThumb Width="3"
|
||||
Cursor="SizeWE"
|
||||
VerticalAlignment="Stretch"
|
||||
HorizontalAlignment="Left"/>
|
||||
<s:ResizeThumb Width="3"
|
||||
Cursor="SizeWE"
|
||||
VerticalAlignment="Stretch"
|
||||
HorizontalAlignment="Right"/>
|
||||
<s:ResizeThumb Height="3"
|
||||
Cursor="SizeNS"
|
||||
VerticalAlignment="Bottom"
|
||||
HorizontalAlignment="Stretch"/>
|
||||
<s:ResizeThumb Width="7"
|
||||
Height="7"
|
||||
Margin="-2"
|
||||
Cursor="SizeNWSE"
|
||||
VerticalAlignment="Top"
|
||||
HorizontalAlignment="Left"/>
|
||||
<s:ResizeThumb Width="7"
|
||||
Height="7"
|
||||
Margin="-2"
|
||||
Cursor="SizeNESW"
|
||||
VerticalAlignment="Top"
|
||||
HorizontalAlignment="Right"/>
|
||||
<s:ResizeThumb Width="7"
|
||||
Height="7"
|
||||
Margin="-2"
|
||||
Cursor="SizeNESW"
|
||||
VerticalAlignment="Bottom"
|
||||
HorizontalAlignment="Left"/>
|
||||
<s:ResizeThumb Width="7"
|
||||
Height="7"
|
||||
Margin="-2"
|
||||
Cursor="SizeNWSE"
|
||||
VerticalAlignment="Bottom"
|
||||
HorizontalAlignment="Right"/>
|
||||
</Grid>
|
||||
<Canvas HorizontalAlignment="Right" VerticalAlignment="Top">
|
||||
<ContentControl Canvas.Left="10" Content="{Binding Tag}" />
|
||||
</Canvas>
|
||||
<Grid IsHitTestVisible="False" Opacity="1" Margin="-3">
|
||||
<Rectangle SnapsToDevicePixels="True"
|
||||
StrokeThickness="1"
|
||||
Margin="1"
|
||||
Stroke="{DynamicResource DisabledBorderBrush}" StrokeDashArray="1 0 1"/>
|
||||
<Line StrokeThickness="1" X1="0" Y1="0" X2="0" Y2="20" Visibility="{Binding Path=DataContext.(s:VisualExtensions.CanRotate), RelativeSource={RelativeSource Self}, Converter={StaticResource btvc}}"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Top"
|
||||
Margin="0,-19,0,0"
|
||||
Stroke="White" StrokeDashArray="1 2"/>
|
||||
<Path Style="{StaticResource ThumbCorner}" Stretch="Uniform" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,-20,0,0" Width="20" Height="20" Data="M 11.7927,9.92031C 12.5184,8.74318 12.6759,7.05297 12.1717,5.75967C 11.5909,4.44354 10.2501,3.37314 8.87896,3.04485C 7.39649,2.74559 5.63977,3.1934 4.48733,4.196C 3.50995,5.1756 2.91946,6.75691 3.08599,8.14841L 0.0842173,8.57665C 0.0347556,8.20576 0.00766225,7.8312 -1.64198e-005,7.45693C 0.038148,6.21681 0.383575,4.9557 0.968669,3.8699C 1.5589,2.89611 2.36362,2.03356 3.28126,1.37902C 5.28605,0.0810452 8.05891,-0.284222 10.3301,0.412526C 12.1794,1.09169 13.9099,2.53647 14.8289,4.31779C 15.3434,5.43808 15.5957,6.72245 15.5449,7.95982C 15.4307,9.19718 15.0066,10.4344 14.358,11.484L 16.0043,12.4819L 11.226,13.5191L 10.1463,8.92239L 11.7927,9.92031 Z M -1.64198e-005,-1.90735e-006 Z M 15.564,14.9728 Z "
|
||||
Fill="YellowGreen" Stroke="{DynamicResource PressedBorderBrush}"
|
||||
Visibility="{Binding Path=DataContext.(s:VisualExtensions.CanRotate), RelativeSource={RelativeSource Self}, Converter={StaticResource btvc}}"
|
||||
/>
|
||||
<Rectangle Style="{StaticResource ThumbCorner}" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
||||
<Rectangle Style="{StaticResource ThumbCorner}" HorizontalAlignment="Right" VerticalAlignment="Top"/>
|
||||
<Rectangle Style="{StaticResource ThumbCorner}" HorizontalAlignment="Left" VerticalAlignment="Bottom"/>
|
||||
<Rectangle Style="{StaticResource ThumbCorner}" HorizontalAlignment="Right" VerticalAlignment="Bottom"/>
|
||||
<Viewbox Width="16" Height="16" HorizontalAlignment="Right" VerticalAlignment="Top" IsHitTestVisible="False" Margin="0,-20,0,0">
|
||||
<Path Width="16" Height="16" Stretch="Fill" Fill="{DynamicResource NormalBrush}" StrokeThickness=".5" Stroke="{DynamicResource GlyphBrush}" Data="M 0,8.L 3.18485,4.81417L 3.18485,6.37077L 6.37181,6.37077L 6.37181,3.18408L 4.81418,3.18408L 8.00114,0L 11.1881,3.18408L 9.63047,3.18408L 9.63047,6.37077L 12.8174,6.37077L 12.8174,4.81417L 16.0044,8.L 12.8174,11.1876L 12.8174,9.63096L 9.63047,9.63096L 9.63047,12.8177L 11.1881,12.8177L 8.00114,16.0044L 4.81418,12.8177L 6.37181,12.8177L 6.37181,9.63096L 3.18485,9.63096L 3.18485,11.1876L 0,8. Z M 0,0 Z M 16.0044,16.0044 Z"/>
|
||||
</Viewbox>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
49
BrightSharp.NET/Themes/Diagrams/SizeChrome.xaml
Normal file
49
BrightSharp.NET/Themes/Diagrams/SizeChrome.xaml
Normal file
@@ -0,0 +1,49 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:s="clr-namespace:BrightSharp.Diagrams">
|
||||
|
||||
<s:DoubleFormatConverter x:Key="doubleFormatConverter"/>
|
||||
|
||||
<Style TargetType="{x:Type s:SizeChrome}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type s:SizeChrome}">
|
||||
<Grid SnapsToDevicePixels="True">
|
||||
<Path Stroke="Red"
|
||||
StrokeThickness="1"
|
||||
Height="10"
|
||||
VerticalAlignment="Bottom"
|
||||
Margin="-2,0,-2,-15"
|
||||
Stretch="Fill"
|
||||
Data="M0,0 0,10 M 0,5 100,5 M 100,0 100,10" StrokeDashArray="1 2"/>
|
||||
<TextBlock Text="{Binding Path=Width, Converter={StaticResource doubleFormatConverter}}"
|
||||
Background="White"
|
||||
Padding="3,0,3,0"
|
||||
Foreground="#FF9C3535"
|
||||
Margin="0,0,0,-18"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Bottom"/>
|
||||
<Path Stroke="#FF9C3535"
|
||||
StrokeThickness="1"
|
||||
Width="10"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="0,-2,-15,-2"
|
||||
Stretch="Fill"
|
||||
Data="M5,0 5,100 M 0,0 10,0 M 0,100 10,100" StrokeDashArray="1 2"/>
|
||||
<TextBlock Text="{Binding Path=Height, Converter={StaticResource doubleFormatConverter}}"
|
||||
Background="White"
|
||||
Foreground="#FF9C3535"
|
||||
Padding="3,0,3,0"
|
||||
Margin="0,0,-18,0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center">
|
||||
<TextBlock.LayoutTransform>
|
||||
<RotateTransform Angle="90" CenterX="1" CenterY="0.5"/>
|
||||
</TextBlock.LayoutTransform>
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
5
BrightSharp.NET/Themes/Generic.xaml
Normal file
5
BrightSharp.NET/Themes/Generic.xaml
Normal file
@@ -0,0 +1,5 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
|
||||
</ResourceDictionary>
|
||||
326
BrightSharp.NET/Themes/Style.Blue.xaml
Normal file
326
BrightSharp.NET/Themes/Style.Blue.xaml
Normal file
@@ -0,0 +1,326 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:s="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<s:Boolean x:Key="IsInverseTheme">False</s:Boolean>
|
||||
|
||||
<CornerRadius x:Key="DefaultRadiusSmall">1</CornerRadius>
|
||||
<CornerRadius x:Key="DefaultRadiusNormal">3</CornerRadius>
|
||||
|
||||
<CornerRadius x:Key="TabItemRadius">0,8,0,0</CornerRadius>
|
||||
<CornerRadius x:Key="TabRadiusTop">0,2,2,2</CornerRadius>
|
||||
<CornerRadius x:Key="TabRadiusLeft">0,5,5,0</CornerRadius>
|
||||
<CornerRadius x:Key="TabRadiusRight">5,0,0,5</CornerRadius>
|
||||
<CornerRadius x:Key="TabRadiusBottom">5,5,0,0</CornerRadius>
|
||||
|
||||
<Color x:Key="ValidationErrorColor">Red</Color>
|
||||
|
||||
<LinearGradientBrush x:Key="NormalBrush" StartPoint="0,1" EndPoint="0,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="White" Offset="1.0"/>
|
||||
<GradientStop Color="#FFC4C8E6" Offset="0.6"/>
|
||||
<GradientStop Color="#FFC0C4DE" Offset="0.55"/>
|
||||
<GradientStop Color="#FFC6DAFF" Offset="0.0"/>
|
||||
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="VerticalNormalBrush" StartPoint="1,0" EndPoint="0,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="White" Offset="1.0"/>
|
||||
<GradientStop Color="#FFC4C8E6" Offset="0.6"/>
|
||||
<GradientStop Color="#FFC0C4DE" Offset="0.55"/>
|
||||
<GradientStop Color="#FFC6DAFF" Offset="0.0"/>
|
||||
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="NormalProgressBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FF3CCF37" Offset="0.0"/>
|
||||
<GradientStop Color="#FF2FA22A" Offset="0.5"/>
|
||||
<GradientStop Color="#FFA6C5A5" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="ProgressBarIndicatorAnimatedFill">
|
||||
<LinearGradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
|
||||
<GradientStop Color="#00ffffff"
|
||||
Offset="0" />
|
||||
<GradientStop Color="#c0ffffff"
|
||||
Offset="0.3" />
|
||||
<GradientStop Color="#d0ffffff"
|
||||
Offset="0.8" />
|
||||
<GradientStop Color="#00ffffff"
|
||||
Offset="1" />
|
||||
</GradientStopCollection>
|
||||
</LinearGradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="ProgressBarIndeterminateRootBrush" EndPoint="0.5,1" StartPoint="0.5,0">
|
||||
<GradientStop Color="#F6BCD5FF" Offset="0.046" />
|
||||
<GradientStop Color="#96D4E4FF" Offset="0.18" />
|
||||
<GradientStop Color="#4FFFFFFF" Offset="0.512" />
|
||||
<GradientStop Color="#00D6D6D6" Offset="0.521" />
|
||||
<GradientStop Color="#BABCD5FF" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="ProgressBarIndeterminateFillBrush" EndPoint="0,1" StartPoint="20,1" MappingMode="Absolute" SpreadMethod="Repeat">
|
||||
<LinearGradientBrush.Transform>
|
||||
<TransformGroup>
|
||||
<SkewTransform AngleX="-10" />
|
||||
</TransformGroup>
|
||||
</LinearGradientBrush.Transform>
|
||||
<GradientStop Color="#FFBCD5FF" Offset="0.088" />
|
||||
<GradientStop Color="#006EA4FD" Offset="0.475" />
|
||||
<GradientStop Color="#FFBCD5FF" Offset="0.899" />
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="NormalBorderBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FF605CBB" Offset="0.0"/>
|
||||
<GradientStop Color="#FF5B4F4F" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
|
||||
<LinearGradientBrush x:Key="HorizontalNormalBorderBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FFACA3D4" Offset="0.0"/>
|
||||
<GradientStop Color="#FF4F2A2A" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<SolidColorBrush x:Key="TopLevelMenuBackgroundHover" Color="#FFFCFFBD" />
|
||||
|
||||
<!-- Light Brush -->
|
||||
|
||||
<LinearGradientBrush x:Key="LightBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="White" Offset="0.0"/>
|
||||
<GradientStop Color="#FFD9E1F9" Offset="0.5"/>
|
||||
<GradientStop Color="#FFDDDDFB" Offset="0.85"/>
|
||||
<GradientStop Color="#FFAFBDE2" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="HorizontalLightBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="White" Offset="0.0"/>
|
||||
<GradientStop Color="#FFD9E1F9" Offset="0.5"/>
|
||||
<GradientStop Color="#FFDDDDFB" Offset="0.85"/>
|
||||
<GradientStop Color="#FF9B9B9B" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<!-- Dark Brush -->
|
||||
|
||||
<LinearGradientBrush x:Key="DarkBrush" StartPoint="0,1" EndPoint="0,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="White" Offset="1.0"/>
|
||||
<GradientStop Color="#FFCCD0E8" Offset="0.6"/>
|
||||
<GradientStop Color="#FFC4CAF1" Offset="0.55"/>
|
||||
<GradientStop Color="#FFD1E1FF" Offset="0.0"/>
|
||||
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="VerticalDarkBrush" StartPoint="1,0" EndPoint="0,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FFCDD6F5" Offset="1.0"/>
|
||||
<GradientStop Color="#FF99A6E6" Offset="0.6"/>
|
||||
<GradientStop Color="#FFB5B3EC" Offset="0.55"/>
|
||||
<GradientStop Color="#FFD8E8FD" Offset="0.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<!-- Pressed Brush -->
|
||||
|
||||
<LinearGradientBrush x:Key="PressedBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FFF6FBC5" Offset="0.0"/>
|
||||
<GradientStop Color="#FFE2D231" Offset="0.2"/>
|
||||
<GradientStop Color="#FFE5FFB9" Offset="0.9"/>
|
||||
<GradientStop Color="#FFF" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
|
||||
<LinearGradientBrush x:Key="TogglePressedBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FFF6FBC5" Offset="0.0"/>
|
||||
<GradientStop Color="#FFE2D231" Offset="0.2"/>
|
||||
<GradientStop Color="#FFE5FFB9" Offset="0.9"/>
|
||||
<GradientStop Color="#FFF" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="VerticalPressedBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FFF6FBC5" Offset="0.0"/>
|
||||
<GradientStop Color="#FFE2D231" Offset="0.2"/>
|
||||
<GradientStop Color="#FFE5FFB9" Offset="0.9"/>
|
||||
<GradientStop Color="#FFF" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="PressedBorderBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FF870000" Offset="0.0"/>
|
||||
<GradientStop Color="#FF5D5D5D" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<!-- Defaulted Brush -->
|
||||
|
||||
<LinearGradientBrush x:Key="DefaultedBorderBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#777" Offset="0.0"/>
|
||||
<GradientStop Color="#000" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<!-- Disabled Brush -->
|
||||
|
||||
<SolidColorBrush x:Key="DisabledForegroundBrush" Color="#FF303030" />
|
||||
<SolidColorBrush x:Key="DisabledBackgroundBrush" Color="#FFB7B7B7" />
|
||||
<SolidColorBrush x:Key="DisabledBorderBrush" Color="#FF7E7070" />
|
||||
|
||||
<!-- Border Brushes -->
|
||||
|
||||
<SolidColorBrush x:Key="SolidBorderBrush" Color="#FF1D426E" />
|
||||
<SolidColorBrush x:Key="LightBorderBrush" Color="#FF9E9E9E" />
|
||||
|
||||
<!-- Miscellaneous Brushes -->
|
||||
|
||||
<LinearGradientBrush x:Key="ScrollBarPageButtonVertBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientStopCollection>
|
||||
<GradientStop Offset="0" Color="#FFD3DBFF" />
|
||||
<GradientStop Offset="0.3" Color="White" />
|
||||
<GradientStop Offset="0.7" Color="White" />
|
||||
<GradientStop Offset="1" Color="#FFD3DBFF" />
|
||||
</GradientStopCollection>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="ScrollBarPageButtonHorizBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientStopCollection>
|
||||
<GradientStop Offset="0" Color="#FFD3DBFF" />
|
||||
<GradientStop Offset="0.3" Color="White" />
|
||||
<GradientStop Offset="0.7" Color="White" />
|
||||
<GradientStop Offset="1" Color="#FFD3DBFF" />
|
||||
</GradientStopCollection>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="TabItemSelectedBackgroundBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FFE0FFC1" Offset="0.0"/>
|
||||
<GradientStop Color="#FFBCE6B2" Offset="0.2"/>
|
||||
<GradientStop Color="#FFE3FFD5" Offset="0.85"/>
|
||||
<GradientStop Color="White" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<SolidColorBrush x:Key="MainMenuForegroundBrush" Color="Black"/>
|
||||
|
||||
|
||||
|
||||
<!--Color STYLED Brush-->
|
||||
|
||||
<LinearGradientBrush x:Key="WindowBackgroundBrush">
|
||||
<GradientStopCollection>
|
||||
<GradientStop Offset="0" Color="#EFEBF8FF" />
|
||||
<GradientStop Offset="1" Color="#EFF3F3F3" />
|
||||
</GradientStopCollection>
|
||||
</LinearGradientBrush>
|
||||
<Color x:Key="WindowBackgroundHoverColor">#FFF</Color>
|
||||
<LinearGradientBrush x:Key="SelectedBackgroundBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientStop Color="#CC9ACBFF" Offset="0" />
|
||||
<GradientStop Color="#FF7DBAFF" Offset=".3" />
|
||||
<GradientStop Color="#FF7DBAFF" Offset=".7" />
|
||||
<GradientStop Color="#CC9ACBFF" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
<SolidColorBrush x:Key="GlyphBrush" Color="#FF2B1717" />
|
||||
<SolidColorBrush x:Key="LightColorBrush" Color="#E9ECF8" />
|
||||
<Color x:Key="OnWindowForegroundColor">#FF1B140F</Color>
|
||||
<Color x:Key="SelectedUnfocusedColor">#FFB6B6B6</Color>
|
||||
<SolidColorBrush x:Key="ScrollBarBackgroundBrush" Color="#F0F0F0" />
|
||||
<SolidColorBrush x:Key="SynWindowBackgroundBrush" Color="#FFD1D1D1" />
|
||||
<Color x:Key="SelectedBackgroundColor">#FFFFF8B8</Color>
|
||||
<SolidColorBrush x:Key="OnWindowForegroundBrush" Color="{DynamicResource OnWindowForegroundColor}" />
|
||||
<SolidColorBrush x:Key="HighLightForegroundBrush" Color="#FF500000" />
|
||||
<Color x:Key="UiForegroundColor">Black</Color>
|
||||
<SolidColorBrush x:Key="AlternatingRowBackgroundBrush" Color="#F1EFFF" />
|
||||
<SolidColorBrush x:Key="RowBackgroundBrush" Color="White"/>
|
||||
<SolidColorBrush x:Key="UiForegroundBrush" Color="{DynamicResource UiForegroundColor}" />
|
||||
<Color x:Key="ControlLightColor">#FFFFFFFF</Color>
|
||||
<Color x:Key="ControlMediumColor">#FFC5C5C5</Color>
|
||||
<Color x:Key="ControlDarkColor">#FF6B6B6B</Color>
|
||||
<Color x:Key="ControlMouseOverColor">#FFDADCEC</Color>
|
||||
<Color x:Key="ControlPressedColor">#FF47909B</Color>
|
||||
<Color x:Key="BorderLightColor">#D6D6D6</Color>
|
||||
<Color x:Key="BorderMediumColor">#E6E6E6</Color>
|
||||
|
||||
<!--Window Brushes-->
|
||||
|
||||
<LinearGradientBrush x:Key="GradientWindowBackgroundBrush" EndPoint="1,1" StartPoint="0,0">
|
||||
<GradientStop Color="#FFAFBAD6" Offset="0"/>
|
||||
<GradientStop Color="White" Offset="1"/>
|
||||
<GradientStop Color="#FFD1E3FF" Offset="0.766"/>
|
||||
<GradientStop Color="#FFE2E8F8" Offset="0.238"/>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="WindowHeaderBrush" EndPoint="0,1">
|
||||
<GradientStop Color="#FFE3F1FF" />
|
||||
<GradientStop Color="#FFABBFEC" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
<SolidColorBrush x:Key="WindowHeaderInactiveBackgroundBrush" Color="#8888" />
|
||||
|
||||
<LinearGradientBrush x:Key="WindowHeaderInactiveBrush" EndPoint="0,1">
|
||||
<GradientStop Color="#A5A5A5" />
|
||||
<GradientStop Color="#FF616161" Offset="0.2" />
|
||||
<GradientStop Color="#FF5C5C5C" Offset="0.8" />
|
||||
<GradientStop Color="#FFBEC5CB" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="WindowBorderBrush" EndPoint="0,1" StartPoint="0,0">
|
||||
<GradientStop Color="#FF898989" Offset="0"/>
|
||||
<GradientStop Color="#FF898989" Offset="1"/>
|
||||
<GradientStop Color="LightGray" Offset="0.841"/>
|
||||
<GradientStop Color="#FFCBCBCB" Offset="0.23"/>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="WindowInnerBorderBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientStop Color="#F0F0F0" Offset="1" />
|
||||
<GradientStop Color="White" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
|
||||
|
||||
|
||||
</ResourceDictionary>
|
||||
283
BrightSharp.NET/Themes/Style.Classic.xaml
Normal file
283
BrightSharp.NET/Themes/Style.Classic.xaml
Normal file
@@ -0,0 +1,283 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
|
||||
<!--Radiuses-->
|
||||
|
||||
<CornerRadius x:Key="DefaultRadiusSmall">1</CornerRadius>
|
||||
<CornerRadius x:Key="DefaultRadiusNormal">3</CornerRadius>
|
||||
|
||||
<CornerRadius x:Key="TabItemRadius">0,8,0,0</CornerRadius>
|
||||
<CornerRadius x:Key="TabRadiusTop">0,2,2,2</CornerRadius>
|
||||
<CornerRadius x:Key="TabRadiusLeft">0,5,5,0</CornerRadius>
|
||||
<CornerRadius x:Key="TabRadiusRight">5,0,0,5</CornerRadius>
|
||||
<CornerRadius x:Key="TabRadiusBottom">5,5,0,0</CornerRadius>
|
||||
|
||||
<Color x:Key="ValidationErrorColor">Red</Color>
|
||||
|
||||
<SolidColorBrush x:Key="RowBackgroundBrush" Color="White"/>
|
||||
<LinearGradientBrush x:Key="AlternatingRowBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
|
||||
<GradientStop Color="White"/>
|
||||
<GradientStop Color="White" Offset="1"/>
|
||||
<GradientStop Color="#FFECF5FF" Offset="0.8"/>
|
||||
<GradientStop Color="#FFECF5FF" Offset="0.2"/>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="NormalBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientStop Color="#FFF" Offset="0.0"/>
|
||||
<GradientStop Color="#CCC" Offset="1.0"/>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="VerticalNormalBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FFF" Offset="0.0"/>
|
||||
<GradientStop Color="#CCC" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="ProgressBarIndeterminateRootBrush" EndPoint="0.5,1" StartPoint="0.5,0">
|
||||
<GradientStop Color="#F6BCD5FF" Offset="0.046" />
|
||||
<GradientStop Color="#96D4E4FF" Offset="0.18" />
|
||||
<GradientStop Color="#4FFFFFFF" Offset="0.512" />
|
||||
<GradientStop Color="#00D6D6D6" Offset="0.521" />
|
||||
<GradientStop Color="#BABCD5FF" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="ProgressBarIndeterminateFillBrush" EndPoint="0,1" StartPoint="20,1" MappingMode="Absolute" SpreadMethod="Repeat">
|
||||
<LinearGradientBrush.Transform>
|
||||
<TransformGroup>
|
||||
<SkewTransform AngleX="-10" />
|
||||
</TransformGroup>
|
||||
</LinearGradientBrush.Transform>
|
||||
<GradientStop Color="#FFBCD5FF" Offset="0.088" />
|
||||
<GradientStop Color="#006EA4FD" Offset="0.475" />
|
||||
<GradientStop Color="#FFBCD5FF" Offset="0.899" />
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="NormalProgressBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FF9EFD9B" Offset="0.0"/>
|
||||
<GradientStop Color="#FF2FA22A" Offset="0.4"/>
|
||||
<GradientStop Color="#FFB1ECAF" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="ProgressBarIndicatorAnimatedFill">
|
||||
<LinearGradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
|
||||
<GradientStop Color="#00ffffff"
|
||||
Offset="0" />
|
||||
<GradientStop Color="#c0ffffff"
|
||||
Offset="0.3" />
|
||||
<GradientStop Color="#d0ffffff"
|
||||
Offset="0.8" />
|
||||
<GradientStop Color="#00ffffff"
|
||||
Offset="1" />
|
||||
</GradientStopCollection>
|
||||
</LinearGradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="NormalBorderBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#CCC" Offset="0.0"/>
|
||||
<GradientStop Color="#444" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="HorizontalNormalBorderBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#CCC" Offset="0.0"/>
|
||||
<GradientStop Color="#444" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<SolidColorBrush x:Key="TopLevelMenuBackgroundHover" Color="Pink" />
|
||||
|
||||
<!-- Light Brush -->
|
||||
<LinearGradientBrush x:Key="HorizontalLightBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FFF" Offset="0.0"/>
|
||||
<GradientStop Color="#EEE" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<!-- Dark Brush -->
|
||||
<LinearGradientBrush x:Key="DarkBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FFF" Offset="0.0"/>
|
||||
<GradientStop Color="#AAA" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="VerticalDarkBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FFF" Offset="0.0"/>
|
||||
<GradientStop Color="#AAA" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<!-- Pressed Brush -->
|
||||
<LinearGradientBrush x:Key="PressedBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#E8D4D4" Offset="0.0"/>
|
||||
<GradientStop Color="#E3E8A6" Offset="0.1"/>
|
||||
<GradientStop Color="#ECF699" Offset="0.796"/>
|
||||
<GradientStop Color="#F3F3F3" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="TogglePressedBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#E8D4D4" Offset="0.0"/>
|
||||
<GradientStop Color="#E3E8A6" Offset="0.1"/>
|
||||
<GradientStop Color="#ECF699" Offset="0.796"/>
|
||||
<GradientStop Color="#F3F3F3" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="VerticalPressedBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#E8D4D4" Offset="0.0"/>
|
||||
<GradientStop Color="#E3E8A6" Offset="0.1"/>
|
||||
<GradientStop Color="#ECF699" Offset="0.796"/>
|
||||
<GradientStop Color="#F3F3F3" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="PressedBorderBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#444" Offset="0.0"/>
|
||||
<GradientStop Color="#888" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<!-- Defaulted Brush -->
|
||||
<LinearGradientBrush x:Key="DefaultedBorderBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#777" Offset="0.3"/>
|
||||
<GradientStop Color="#000" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<!-- Disabled Brush -->
|
||||
<SolidColorBrush x:Key="DisabledBorderBrush" Color="#AAA" />
|
||||
|
||||
<!-- Border Brushes -->
|
||||
<SolidColorBrush x:Key="SolidBorderBrush" Color="#888" />
|
||||
<SolidColorBrush x:Key="LightBorderBrush" Color="#AAA" />
|
||||
|
||||
<!-- Miscellaneous Brushes -->
|
||||
<LinearGradientBrush x:Key="ScrollBarPageButtonVertBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientStopCollection>
|
||||
<GradientStop Offset="0" Color="#FFD3DBFF" />
|
||||
<GradientStop Offset="0.3" Color="White" />
|
||||
<GradientStop Offset="0.7" Color="White" />
|
||||
<GradientStop Offset="1" Color="#FFD3DBFF" />
|
||||
</GradientStopCollection>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="ScrollBarPageButtonHorizBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientStopCollection>
|
||||
<GradientStop Offset="0" Color="#FFD3DBFF" />
|
||||
<GradientStop Offset="0.3" Color="White" />
|
||||
<GradientStop Offset="0.7" Color="White" />
|
||||
<GradientStop Offset="1" Color="#FFD3DBFF" />
|
||||
</GradientStopCollection>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="TabItemSelectedBackgroundBrush" 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.85"/>
|
||||
<GradientStop Color="#FFF" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<SolidColorBrush x:Key="MainMenuForegroundBrush" Color="Black"/>
|
||||
|
||||
<!--Color STYLED Brush-->
|
||||
<Color x:Key="WindowBackgroundHoverColor">#FFF</Color>
|
||||
<LinearGradientBrush x:Key="WindowBackgroundBrush">
|
||||
<GradientStop Color="#EEE" />
|
||||
</LinearGradientBrush>
|
||||
<SolidColorBrush x:Key="SelectedBackgroundBrush" Color="#FAE0A0" />
|
||||
<SolidColorBrush x:Key="GlyphBrush" Color="#444" />
|
||||
<SolidColorBrush x:Key="LightColorBrush" Color="#DDD" />
|
||||
<Color x:Key="OnWindowForegroundColor">Black</Color>
|
||||
<SolidColorBrush x:Key="DisabledForegroundBrush" Color="#FF4D4D4D" />
|
||||
<SolidColorBrush x:Key="DisabledBackgroundBrush" Color="#EEE" />
|
||||
<LinearGradientBrush x:Key="LightBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FFF" Offset="0.0"/>
|
||||
<GradientStop Color="#EEE" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<SolidColorBrush x:Key="ScrollBarBackgroundBrush" Color="#F0F0F0" />
|
||||
<SolidColorBrush x:Key="HighLightForegroundBrush" Color="#FF2E2020" />
|
||||
<Color x:Key="SelectedUnfocusedColor">#E0E0EA</Color>
|
||||
<Color x:Key="UiForegroundColor">Black</Color>
|
||||
<Color x:Key="SelectedBackgroundColor">#FAE0A0</Color>
|
||||
<Color x:Key="ControlLightColor">#FFFFFFFF</Color>
|
||||
<Color x:Key="ControlMediumColor">#FFC5C5C5</Color>
|
||||
<Color x:Key="ControlDarkColor">#FF6B6B6B</Color>
|
||||
<Color x:Key="ControlMouseOverColor">#FFDADCEC</Color>
|
||||
<Color x:Key="ControlPressedColor">#FF47909B</Color>
|
||||
<Color x:Key="BorderLightColor">#D6D6D6</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-->
|
||||
|
||||
<SolidColorBrush x:Key="WindowHeaderInactiveBackgroundBrush" Color="#8888" />
|
||||
|
||||
<LinearGradientBrush x:Key="GradientWindowBackgroundBrush" EndPoint="1,1" StartPoint="0,0">
|
||||
|
||||
<GradientStop Color="White" Offset="1"/>
|
||||
<GradientStop Color="#FFE9F2FF" Offset="0.766"/>
|
||||
<GradientStop Color="#FFE2E8F8" Offset="0.238"/>
|
||||
<GradientStop Color="#FFD0D8EC" Offset="0"/>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="WindowHeaderBrush" EndPoint="0,1">
|
||||
<GradientStop Color="#F4F4FF" />
|
||||
<GradientStop Color="#FFD4EAFF" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="WindowHeaderInactiveBrush" EndPoint="0,1">
|
||||
<GradientStop Color="#A5A5A5" />
|
||||
<GradientStop Color="#FF616161" Offset="0.2" />
|
||||
<GradientStop Color="#FF5C5C5C" Offset="0.8" />
|
||||
<GradientStop Color="#FFBEC5CB" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="WindowBorderBrush" EndPoint="0,1" StartPoint="0,0">
|
||||
<GradientStop Color="#FF898989" Offset="0"/>
|
||||
<GradientStop Color="#FF898989" Offset="1"/>
|
||||
<GradientStop Color="LightGray" Offset="0.841"/>
|
||||
<GradientStop Color="#FFCBCBCB" Offset="0.23"/>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="WindowInnerBorderBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientStop Color="#F0F0F0" Offset="1" />
|
||||
<GradientStop Color="White" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
|
||||
</ResourceDictionary>
|
||||
307
BrightSharp.NET/Themes/Style.DarkBlue.xaml
Normal file
307
BrightSharp.NET/Themes/Style.DarkBlue.xaml
Normal file
@@ -0,0 +1,307 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<sys:Boolean x:Key="IsInverseTheme">True</sys:Boolean>
|
||||
|
||||
<CornerRadius x:Key="DefaultRadiusSmall">1</CornerRadius>
|
||||
<CornerRadius x:Key="DefaultRadiusNormal">3</CornerRadius>
|
||||
|
||||
<CornerRadius x:Key="TabItemRadius">0,8,0,0</CornerRadius>
|
||||
<CornerRadius x:Key="TabRadiusTop">0,2,2,2</CornerRadius>
|
||||
<CornerRadius x:Key="TabRadiusLeft">0,5,5,0</CornerRadius>
|
||||
<CornerRadius x:Key="TabRadiusRight">5,0,0,5</CornerRadius>
|
||||
<CornerRadius x:Key="TabRadiusBottom">5,5,0,0</CornerRadius>
|
||||
|
||||
|
||||
<Color x:Key="SelectedBackgroundColor" >#99BDFF</Color>
|
||||
<Color x:Key="SelectedUnfocusedColor" >#999999</Color>
|
||||
<Color x:Key="ControlLightColor" >#FF2F596E</Color>
|
||||
<Color x:Key="ControlMediumColor" >#FF10405B</Color>
|
||||
<Color x:Key="ControlDarkColor" >#FF2B404B</Color>
|
||||
|
||||
<Color x:Key="ControlMouseOverColor" >#FF414888</Color>
|
||||
<Color x:Key="ControlPressedColor" >#FF47909B</Color>
|
||||
<Color x:Key="BorderLightColor">#D6D6D6</Color>
|
||||
<Color x:Key="BorderMediumColor">#E6E6E6</Color>
|
||||
|
||||
<Color x:Key="ValidationErrorColor" >#FF3333</Color>
|
||||
|
||||
<Color x:Key="UiForegroundColor">#ffffff</Color>
|
||||
<SolidColorBrush x:Key="UiForegroundBrush" Color="White" />
|
||||
<Color x:Key="WindowBackgroundHoverColor">#555555</Color>
|
||||
|
||||
<SolidColorBrush x:Key="TopLevelMenuBackgroundHover" Color="#FF414566" />
|
||||
<SolidColorBrush x:Key="DisabledBorderBrush" Color="#FF575757" />
|
||||
|
||||
<SolidColorBrush x:Key="SolidBorderBrush" Color="Black" />
|
||||
<SolidColorBrush x:Key="LightBorderBrush" Color="DarkGray" />
|
||||
<SolidColorBrush x:Key="MainMenuForegroundBrush" Color="White"/>
|
||||
|
||||
<SolidColorBrush x:Key="WindowBackgroundBrush" Color="#444444" />
|
||||
|
||||
<LinearGradientBrush x:Key="GradientWindowBackgroundBrush" EndPoint="1,1" StartPoint="0,0">
|
||||
<GradientStop Color="#FF35373C" Offset="0"/>
|
||||
<GradientStop Color="#FF32353C" Offset="0.2"/>
|
||||
<GradientStop Color="#FF242629" Offset="0.75"/>
|
||||
<GradientStop Color="#FF222326" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="WindowHeaderBrush" EndPoint="0,1">
|
||||
<GradientStop Color="#FF556176" />
|
||||
<GradientStop Color="#FF282B32" Offset="0.2" />
|
||||
<GradientStop Color="#FF262634" Offset="0.8" />
|
||||
<GradientStop Color="#FF15212C" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="WindowBorderBrush" EndPoint="0,1" StartPoint="0,0">
|
||||
<GradientStop Color="#FF2E2E2E" Offset="0"/>
|
||||
<GradientStop Color="#FF1B1B1B" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="WindowInnerBorderBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientStop Color="#181818" Offset="1" />
|
||||
<GradientStop Color="#1D1C21" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="WindowHeaderInactiveBrush" EndPoint="0,1">
|
||||
<GradientStop Color="#5E5E5E" />
|
||||
<GradientStop Color="#FF3B3B3B" Offset="0.2" />
|
||||
<GradientStop Color="#FF3B3B3B" Offset="0.8" />
|
||||
<GradientStop Color="#5E5E5E" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
<SolidColorBrush x:Key="GlyphBrush" Color="#ffffff" />
|
||||
<SolidColorBrush x:Key="LightColorBrush" Color="#FF57575F" />
|
||||
|
||||
<Color x:Key="OnWindowForegroundColor">White</Color>
|
||||
<SolidColorBrush x:Key="OnWindowForegroundBrush" Color="{DynamicResource OnWindowForegroundColor}" />
|
||||
<SolidColorBrush x:Key="DisabledForegroundBrush" Color="#bbb" />
|
||||
<SolidColorBrush x:Key="DisabledBackgroundBrush" Color="#FF303030" />
|
||||
|
||||
<SolidColorBrush x:Key="ScrollBarBackgroundBrush" Color="#FF404040" />
|
||||
|
||||
<SolidColorBrush x:Key="HighLightForegroundBrush" Color="Black" />
|
||||
|
||||
<SolidColorBrush x:Key="AlternatingRowBackgroundBrush" Color="#555555" />
|
||||
<SolidColorBrush x:Key="RowBackgroundBrush" Color="#6C6C6C" />
|
||||
|
||||
|
||||
<LinearGradientBrush x:Key="NormalBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FF08547D" Offset="0.02"/>
|
||||
<GradientStop Color="#FF2A546A" Offset="0.25"/>
|
||||
<GradientStop Color="#FF1F3A49" Offset="0.75"/>
|
||||
<GradientStop Color="#FF3A6F90" Offset="1"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="VerticalNormalBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FF2F596E" Offset="0.02"/>
|
||||
<GradientStop Color="#FF10405B" Offset="1"/>
|
||||
<GradientStop Color="#FF2B404B" Offset="0.209"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="NormalBorderBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FF7A8DAA" Offset="0.0"/>
|
||||
<GradientStop Color="#FF4B4B4B" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="HorizontalNormalBorderBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FF6C6C6C" Offset="0.0"/>
|
||||
<GradientStop Color="#FF8B8B8B" Offset=".5"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<!-- Light Brush -->
|
||||
|
||||
<LinearGradientBrush x:Key="HorizontalLightBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FF616161" Offset="0.0"/>
|
||||
<GradientStop Color="#FF3F3E49" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="DarkBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FF2F4249" Offset="0"/>
|
||||
<GradientStop Color="#FF2D566C" Offset="1"/>
|
||||
<GradientStop Color="#FF004161" Offset="0.507"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="VerticalDarkBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FF5C7783" Offset="0.0"/>
|
||||
<GradientStop Color="#FF47545B" Offset="1"/>
|
||||
<GradientStop Color="#FF134B66" Offset="0.557"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<!-- Pressed Brush -->
|
||||
<LinearGradientBrush x:Key="PressedBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FF368BB4" Offset="0.0"/>
|
||||
<GradientStop Color="#FF306178" Offset="0.55"/>
|
||||
<GradientStop Color="#FF37738F" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="TogglePressedBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FF156489" Offset="0.0"/>
|
||||
<GradientStop Color="#FF2B86B2" Offset="0.2"/>
|
||||
<GradientStop Color="#FF2187B8" Offset="0.55"/>
|
||||
<GradientStop Color="#FF358FB9" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="VerticalPressedBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FF368BB4" Offset="0.0"/>
|
||||
<GradientStop Color="#FF306178" Offset="0.55"/>
|
||||
<GradientStop Color="#FF37738F" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="PressedBorderBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#444" Offset="0.0"/>
|
||||
<GradientStop Color="#888" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<!-- Defaulted Brush -->
|
||||
|
||||
<LinearGradientBrush x:Key="DefaultedBorderBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#777" Offset="0.3"/>
|
||||
<GradientStop Color="#000" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<!-- Disabled Brush -->
|
||||
|
||||
|
||||
<!-- Border Brushes -->
|
||||
|
||||
<!-- Miscellaneous Brushes -->
|
||||
|
||||
<LinearGradientBrush x:Key="ScrollBarPageButtonVertBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientStopCollection>
|
||||
<GradientStop Offset="0" Color="#FF707070" />
|
||||
<GradientStop Offset="0.3" Color="#FF494949" />
|
||||
<GradientStop Offset="0.7" Color="#FF494949" />
|
||||
<GradientStop Offset="1" Color="#FF707070" />
|
||||
</GradientStopCollection>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="ScrollBarPageButtonHorizBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientStopCollection>
|
||||
<GradientStop Offset="0" Color="#FF707070" />
|
||||
<GradientStop Offset="0.3" Color="#FF494949" />
|
||||
<GradientStop Offset="0.7" Color="#FF494949" />
|
||||
<GradientStop Offset="1" Color="#FF707070" />
|
||||
</GradientStopCollection>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="TabItemSelectedBackgroundBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FF3DE459" Offset="0"/>
|
||||
<GradientStop Color="#FF0071A8" Offset="0.05"/>
|
||||
<GradientStop Color="#FF0071A8" Offset="0.5"/>
|
||||
<GradientStop Color="#FF0B374F" Offset="1"/>
|
||||
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
|
||||
|
||||
<!--Color STYLED Brush-->
|
||||
|
||||
|
||||
<LinearGradientBrush x:Key="SelectedBackgroundBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientStop Color="#CC9ACBFF" Offset="0" />
|
||||
<GradientStop Color="#FF7DBAFF" Offset=".3" />
|
||||
<GradientStop Color="#FF7DBAFF" Offset=".7" />
|
||||
<GradientStop Color="#CC9ACBFF" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
|
||||
<LinearGradientBrush x:Key="LightBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FF616161" Offset="0.0"/>
|
||||
<GradientStop Color="#FF3F3E49" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="ListViewFileItemBrush">
|
||||
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="ProgressBarIndeterminateRootBrush" EndPoint="0.5,1" StartPoint="0.5,0">
|
||||
<GradientStop Color="#F6BCD5FF" Offset="0.046" />
|
||||
<GradientStop Color="#96D4E4FF" Offset="0.18" />
|
||||
<GradientStop Color="#4FFFFFFF" Offset="0.512" />
|
||||
<GradientStop Color="#00D6D6D6" Offset="0.521" />
|
||||
<GradientStop Color="#BABCD5FF" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="ProgressBarIndeterminateFillBrush" EndPoint="0,1" StartPoint="20,1" MappingMode="Absolute" SpreadMethod="Repeat">
|
||||
<LinearGradientBrush.Transform>
|
||||
<TransformGroup>
|
||||
<SkewTransform AngleX="-10" />
|
||||
</TransformGroup>
|
||||
</LinearGradientBrush.Transform>
|
||||
<GradientStop Color="#FFBCD5FF" Offset="0.088" />
|
||||
<GradientStop Color="#006EA4FD" Offset="0.475" />
|
||||
<GradientStop Color="#FFBCD5FF" Offset="0.899" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
|
||||
<LinearGradientBrush x:Key="NormalProgressBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FF9BA8FD" Offset="0.0"/>
|
||||
<GradientStop Color="#FF0B1C89" Offset="0.4"/>
|
||||
<GradientStop Color="#FF4B678F" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="ProgressBarIndicatorAnimatedFill">
|
||||
<LinearGradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
|
||||
<GradientStop Color="#00eeeeee"
|
||||
Offset="0" />
|
||||
<GradientStop Color="#c0eeeeee"
|
||||
Offset="0.3" />
|
||||
<GradientStop Color="#d0eeeeee"
|
||||
Offset="0.8" />
|
||||
<GradientStop Color="#00eeeeee"
|
||||
Offset="1" />
|
||||
</GradientStopCollection>
|
||||
</LinearGradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<SolidColorBrush x:Key="WindowHeaderInactiveBackgroundBrush" Color="#8888" />
|
||||
</ResourceDictionary>
|
||||
274
BrightSharp.NET/Themes/Style.DevLab.xaml
Normal file
274
BrightSharp.NET/Themes/Style.DevLab.xaml
Normal file
@@ -0,0 +1,274 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<system:Boolean x:Key="IsInverseTheme">False</system:Boolean>
|
||||
|
||||
<CornerRadius x:Key="DefaultRadiusSmall">0</CornerRadius>
|
||||
<CornerRadius x:Key="DefaultRadiusNormal">1</CornerRadius>
|
||||
|
||||
|
||||
<CornerRadius x:Key="TabRadiusTop">0</CornerRadius>
|
||||
<CornerRadius x:Key="TabRadiusLeft">0</CornerRadius>
|
||||
<CornerRadius x:Key="TabRadiusRight">0</CornerRadius>
|
||||
<CornerRadius x:Key="TabRadiusBottom">0</CornerRadius>
|
||||
<CornerRadius x:Key="TabItemRadius">0,2,0,0</CornerRadius>
|
||||
|
||||
|
||||
<Color x:Key="ValidationErrorColor">Red</Color>
|
||||
|
||||
<SolidColorBrush x:Key="NormalBrush" Color="#FFEDEFFF" />
|
||||
<SolidColorBrush x:Key="VerticalNormalBrush" Color="#FFDFE1EF" />
|
||||
|
||||
<LinearGradientBrush x:Key="ProgressBarIndeterminateRootBrush" EndPoint="0.5,1" StartPoint="0.5,0">
|
||||
<GradientStop Color="#F6BCD5FF" Offset="0.046" />
|
||||
<GradientStop Color="#96D4E4FF" Offset="0.18" />
|
||||
<GradientStop Color="#4FFFFFFF" Offset="0.512" />
|
||||
<GradientStop Color="#00D6D6D6" Offset="0.521" />
|
||||
<GradientStop Color="#BABCD5FF" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="ProgressBarIndeterminateFillBrush" EndPoint="0,1" StartPoint="20,1" MappingMode="Absolute" SpreadMethod="Repeat">
|
||||
<LinearGradientBrush.Transform>
|
||||
<TransformGroup>
|
||||
<SkewTransform AngleX="-10" />
|
||||
</TransformGroup>
|
||||
</LinearGradientBrush.Transform>
|
||||
<GradientStop Color="#FFBCD5FF" Offset="0.088" />
|
||||
<GradientStop Color="#006EA4FD" Offset="0.475" />
|
||||
<GradientStop Color="#FFBCD5FF" Offset="0.899" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
|
||||
<LinearGradientBrush x:Key="NormalProgressBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FF678D66" Offset="0.0"/>
|
||||
<GradientStop Color="#FF2FA22A" Offset="0.4"/>
|
||||
<GradientStop Color="#FF576A56" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="ProgressBarIndicatorAnimatedFill">
|
||||
<LinearGradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
|
||||
<GradientStop Color="#00ffffff"
|
||||
Offset="0" />
|
||||
<GradientStop Color="#c0ffffff"
|
||||
Offset="0.3" />
|
||||
<GradientStop Color="#d0ffffff"
|
||||
Offset="0.8" />
|
||||
<GradientStop Color="#00ffffff"
|
||||
Offset="1" />
|
||||
</GradientStopCollection>
|
||||
</LinearGradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="NormalBorderBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#CCC" Offset="0.0"/>
|
||||
<GradientStop Color="#444" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
|
||||
<LinearGradientBrush x:Key="HorizontalNormalBorderBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#CCC" Offset="0.0"/>
|
||||
<GradientStop Color="#444" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<SolidColorBrush x:Key="TopLevelMenuBackgroundHover" Color="White" />
|
||||
|
||||
<!-- Light Brush -->
|
||||
|
||||
|
||||
<LinearGradientBrush x:Key="HorizontalLightBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FFF" Offset="0.0"/>
|
||||
<GradientStop Color="#EEE" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<!-- Dark Brush -->
|
||||
|
||||
<LinearGradientBrush x:Key="DarkBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FFF" Offset="0.0"/>
|
||||
<GradientStop Color="#FFD7DDFF" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="VerticalDarkBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FFF" Offset="0.0"/>
|
||||
<GradientStop Color="#FFD7DDFF" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<!-- Pressed Brush -->
|
||||
|
||||
<LinearGradientBrush x:Key="PressedBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="White" Offset="0.0"/>
|
||||
<GradientStop Color="#FFFFBC8D" Offset="0.1"/>
|
||||
<GradientStop Color="#FFFFB49E" Offset="0.796"/>
|
||||
<GradientStop Color="#FFFFF4F4" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="TogglePressedBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="White" Offset="0.0"/>
|
||||
<GradientStop Color="#FFFFBC8D" Offset="0.1"/>
|
||||
<GradientStop Color="#FFFFB49E" Offset="0.796"/>
|
||||
<GradientStop Color="#FFFFF4F4" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="VerticalPressedBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="White" Offset="0.0"/>
|
||||
<GradientStop Color="#FFFFBC8D" Offset="0.1"/>
|
||||
<GradientStop Color="#FFFFB49E" Offset="0.796"/>
|
||||
<GradientStop Color="#FFFFF4F4" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="PressedBorderBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#444" Offset="0.0"/>
|
||||
<GradientStop Color="#444" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<!-- Defaulted Brush -->
|
||||
|
||||
<SolidColorBrush x:Key="DefaultedBorderBrush" Color="Black"/>
|
||||
|
||||
<!-- Disabled Brush -->
|
||||
|
||||
<SolidColorBrush x:Key="DisabledBorderBrush" Color="#AAA" />
|
||||
|
||||
<!-- Border Brushes -->
|
||||
|
||||
<SolidColorBrush x:Key="SolidBorderBrush" Color="#888" />
|
||||
<SolidColorBrush x:Key="LightBorderBrush" Color="#AAA" />
|
||||
|
||||
<!-- Miscellaneous Brushes -->
|
||||
|
||||
<SolidColorBrush x:Key="ScrollBarPageButtonVertBrush" Color="#FFF3F3F3" />
|
||||
|
||||
<SolidColorBrush x:Key="ScrollBarPageButtonHorizBrush" Color="White" />
|
||||
|
||||
|
||||
<SolidColorBrush x:Key="TabItemSelectedBackgroundBrush" Color="#FFF0E0FF"/>
|
||||
|
||||
<SolidColorBrush x:Key="MainMenuForegroundBrush" Color="Black"/>
|
||||
|
||||
|
||||
<!--Color STYLED Brush-->
|
||||
|
||||
<SolidColorBrush x:Key="WindowBackgroundBrush" Color="White" />
|
||||
|
||||
<Color x:Key="WindowBackgroundHoverColor">White</Color>
|
||||
|
||||
<SolidColorBrush x:Key="SelectedBackgroundBrush" Color="#FFFFE0E0" />
|
||||
<SolidColorBrush x:Key="GlyphBrush" Color="#444" />
|
||||
<SolidColorBrush x:Key="LightColorBrush" Color="#FFF3F3F3" />
|
||||
|
||||
<Color x:Key="OnWindowForegroundColor">Black</Color>
|
||||
<SolidColorBrush x:Key="OnWindowForegroundBrush" Color="{DynamicResource OnWindowForegroundColor}" />
|
||||
<SolidColorBrush x:Key="DisabledForegroundBrush" Color="#FF4D4D4D" />
|
||||
<SolidColorBrush x:Key="DisabledBackgroundBrush" Color="#EEE" />
|
||||
|
||||
|
||||
<LinearGradientBrush x:Key="LightBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="White" Offset="0.0"/>
|
||||
<GradientStop Color="#FFF3F3F3" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<SolidColorBrush x:Key="ScrollBarBackgroundBrush" Color="#F0F0F0" />
|
||||
<SolidColorBrush x:Key="SynWindowBackgroundBrush" Color="#FFE4E4E4" />
|
||||
|
||||
<SolidColorBrush x:Key="HighLightForegroundBrush" Color="#FF500000" />
|
||||
|
||||
<Color x:Key="UiForegroundColor">Black</Color>
|
||||
<SolidColorBrush x:Key="UiForegroundBrush" Color="{DynamicResource UiForegroundColor}" />
|
||||
|
||||
|
||||
<SolidColorBrush x:Key="AlternatingRowBackgroundBrush" Color="#F1F1F1" />
|
||||
<SolidColorBrush x:Key="RowBackgroundBrush" Color="White"/>
|
||||
|
||||
|
||||
<Color x:Key="SelectedBackgroundColor">#E3E3E3</Color>
|
||||
<Color x:Key="SelectedUnfocusedColor">#FFD6E6E6</Color>
|
||||
<Color x:Key="ControlLightColor">#FFFFFFFF</Color>
|
||||
<Color x:Key="ControlMediumColor">#FFC5C5C5</Color>
|
||||
<Color x:Key="ControlDarkColor">#FF6B6B6B</Color>
|
||||
|
||||
<Color x:Key="ControlMouseOverColor">#FFEEEEEE</Color>
|
||||
<Color x:Key="ControlPressedColor">#FF47909B</Color>
|
||||
<Color x:Key="BorderLightColor">#D6D6D6</Color>
|
||||
<Color x:Key="BorderMediumColor">#E6E6E6</Color>
|
||||
|
||||
<!--Window Brushes-->
|
||||
|
||||
<SolidColorBrush x:Key="WindowHeaderInactiveBackgroundBrush" Color="#8888" />
|
||||
|
||||
<LinearGradientBrush x:Key="GradientWindowBackgroundBrush" EndPoint="1,1" StartPoint="0,0">
|
||||
|
||||
<GradientStop Color="White" Offset="1"/>
|
||||
<GradientStop Color="#FFE9F2FF" Offset="0.766"/>
|
||||
<GradientStop Color="#FFE2E8F8" Offset="0.238"/>
|
||||
<GradientStop Color="#FFD0D8EC" Offset="0"/>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="WindowHeaderBrush" EndPoint="0,1">
|
||||
<GradientStop Color="#F4F4FF" />
|
||||
<GradientStop Color="#FFD4EAFF" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="WindowHeaderInactiveBrush" EndPoint="0,1">
|
||||
<GradientStop Color="#A5A5A5" />
|
||||
<GradientStop Color="#FF616161" Offset="0.2" />
|
||||
<GradientStop Color="#FF5C5C5C" Offset="0.8" />
|
||||
<GradientStop Color="#FFBEC5CB" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="WindowBorderBrush" EndPoint="0,1" StartPoint="0,0">
|
||||
<GradientStop Color="#FF898989" Offset="0"/>
|
||||
<GradientStop Color="#FF898989" Offset="1"/>
|
||||
<GradientStop Color="LightGray" Offset="0.841"/>
|
||||
<GradientStop Color="#FFCBCBCB" Offset="0.23"/>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="WindowInnerBorderBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientStop Color="#F0F0F0" Offset="1" />
|
||||
<GradientStop Color="White" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
|
||||
</ResourceDictionary>
|
||||
324
BrightSharp.NET/Themes/Style.Silver.xaml
Normal file
324
BrightSharp.NET/Themes/Style.Silver.xaml
Normal file
@@ -0,0 +1,324 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<sys:Boolean x:Key="IsInverseTheme">False</sys:Boolean>
|
||||
|
||||
<CornerRadius x:Key="DefaultRadiusSmall">1</CornerRadius>
|
||||
<CornerRadius x:Key="DefaultRadiusNormal">3</CornerRadius>
|
||||
|
||||
<CornerRadius x:Key="TabItemRadius">0,8,0,0</CornerRadius>
|
||||
<CornerRadius x:Key="TabRadiusTop">0,2,2,2</CornerRadius>
|
||||
<CornerRadius x:Key="TabRadiusLeft">0,5,5,0</CornerRadius>
|
||||
<CornerRadius x:Key="TabRadiusRight">5,0,0,5</CornerRadius>
|
||||
<CornerRadius x:Key="TabRadiusBottom">5,5,0,0</CornerRadius>
|
||||
|
||||
<Color x:Key="ValidationErrorColor">Red</Color>
|
||||
|
||||
<LinearGradientBrush x:Key="NormalBrush" 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="VerticalNormalBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FFF" Offset="0.0"/>
|
||||
<GradientStop Color="#CCC" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="ProgressBarIndeterminateRootBrush" EndPoint="0.5,1" StartPoint="0.5,0">
|
||||
<GradientStop Color="#F6BCD5FF" Offset="0.046" />
|
||||
<GradientStop Color="#96D4E4FF" Offset="0.18" />
|
||||
<GradientStop Color="#4FFFFFFF" Offset="0.512" />
|
||||
<GradientStop Color="#00D6D6D6" Offset="0.521" />
|
||||
<GradientStop Color="#BABCD5FF" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="ProgressBarIndeterminateFillBrush" EndPoint="0,1" StartPoint="20,1" MappingMode="Absolute" SpreadMethod="Repeat">
|
||||
<LinearGradientBrush.Transform>
|
||||
<TransformGroup>
|
||||
<SkewTransform AngleX="-10" />
|
||||
</TransformGroup>
|
||||
</LinearGradientBrush.Transform>
|
||||
<GradientStop Color="#FFBCD5FF" Offset="0.088" />
|
||||
<GradientStop Color="#006EA4FD" Offset="0.475" />
|
||||
<GradientStop Color="#FFBCD5FF" Offset="0.899" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
|
||||
<LinearGradientBrush x:Key="NormalProgressBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FF9B9B9B" Offset="0"/>
|
||||
<GradientStop Color="#FFB9B9B9" Offset="0.5"/>
|
||||
<GradientStop Color="#FFE8E8E8" Offset="1"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="ProgressBarIndicatorAnimatedFill">
|
||||
<LinearGradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
|
||||
<GradientStop Color="#00ffffff"
|
||||
Offset="0" />
|
||||
<GradientStop Color="#c0ffffff"
|
||||
Offset="0.3" />
|
||||
<GradientStop Color="#d0ffffff"
|
||||
Offset="0.8" />
|
||||
<GradientStop Color="#00ffffff"
|
||||
Offset="1" />
|
||||
</GradientStopCollection>
|
||||
</LinearGradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="NormalBorderBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#CCC" Offset="0.0"/>
|
||||
<GradientStop Color="#444" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
|
||||
<LinearGradientBrush x:Key="HorizontalNormalBorderBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#CCC" Offset="0.0"/>
|
||||
<GradientStop Color="#444" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<SolidColorBrush x:Key="TopLevelMenuBackgroundHover" Color="Pink" />
|
||||
|
||||
<!-- Light Brush -->
|
||||
|
||||
|
||||
<LinearGradientBrush x:Key="HorizontalLightBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FFF" Offset="0.0"/>
|
||||
<GradientStop Color="#EEE" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<!-- Dark Brush -->
|
||||
|
||||
<LinearGradientBrush x:Key="DarkBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FFF" Offset="0.0"/>
|
||||
<GradientStop Color="#AAA" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="VerticalDarkBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FFF" Offset="0.0"/>
|
||||
<GradientStop Color="#AAA" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
<!-- Pressed Brush -->
|
||||
|
||||
<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>
|
||||
|
||||
<LinearGradientBrush x:Key="TogglePressedBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#E8D4D4" Offset="0.0"/>
|
||||
<GradientStop Color="#E3E8A6" Offset="0.1"/>
|
||||
<GradientStop Color="#ECF699" Offset="0.796"/>
|
||||
<GradientStop Color="#F3F3F3" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="VerticalPressedBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<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>
|
||||
|
||||
<LinearGradientBrush x:Key="PressedBorderBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#444" Offset="0.0"/>
|
||||
<GradientStop Color="#888" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<!-- Defaulted Brush -->
|
||||
|
||||
<LinearGradientBrush x:Key="DefaultedBorderBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#777" Offset="0.3"/>
|
||||
<GradientStop Color="#000" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<!-- Disabled Brush -->
|
||||
|
||||
<SolidColorBrush x:Key="DisabledBorderBrush" Color="#AAA" />
|
||||
|
||||
<!-- Border Brushes -->
|
||||
|
||||
<SolidColorBrush x:Key="SolidBorderBrush" Color="#888" />
|
||||
<SolidColorBrush x:Key="LightBorderBrush" Color="#AAA" />
|
||||
|
||||
<!-- Miscellaneous Brushes -->
|
||||
|
||||
<LinearGradientBrush x:Key="ScrollBarPageButtonVertBrush" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientStopCollection>
|
||||
<GradientStop Offset="0" Color="#FFD3DBFF" />
|
||||
<GradientStop Offset="0.3" Color="White" />
|
||||
<GradientStop Offset="0.7" Color="White" />
|
||||
<GradientStop Offset="1" Color="#FFD3DBFF" />
|
||||
</GradientStopCollection>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="ScrollBarPageButtonHorizBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientStopCollection>
|
||||
<GradientStop Offset="0" Color="#FFD3DBFF" />
|
||||
<GradientStop Offset="0.3" Color="White" />
|
||||
<GradientStop Offset="0.7" Color="White" />
|
||||
<GradientStop Offset="1" Color="#FFD3DBFF" />
|
||||
</GradientStopCollection>
|
||||
</LinearGradientBrush>
|
||||
|
||||
|
||||
<LinearGradientBrush x:Key="TabItemSelectedBackgroundBrush" 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.85"/>
|
||||
<GradientStop Color="#FFF" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<SolidColorBrush x:Key="MainMenuForegroundBrush" Color="Black"/>
|
||||
|
||||
|
||||
<!--Color STYLED Brush-->
|
||||
|
||||
<LinearGradientBrush x:Key="WindowBackgroundBrush">
|
||||
<GradientStop Color="#EEE" />
|
||||
</LinearGradientBrush>
|
||||
<Color x:Key="WindowBackgroundHoverColor">#FFF</Color>
|
||||
|
||||
<LinearGradientBrush x:Key="SelectedBackgroundBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientStop Color="#CC9ACBFF" Offset="0" />
|
||||
<GradientStop Color="#FF7DBAFF" Offset=".3" />
|
||||
<GradientStop Color="#FF7DBAFF" Offset=".7" />
|
||||
<GradientStop Color="#CC9ACBFF" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
<SolidColorBrush x:Key="GlyphBrush" Color="#444" />
|
||||
<SolidColorBrush x:Key="LightColorBrush" Color="#DDD" />
|
||||
|
||||
<Color x:Key="OnWindowForegroundColor">Black</Color>
|
||||
<SolidColorBrush x:Key="OnWindowForegroundBrush" Color="{DynamicResource OnWindowForegroundColor}" />
|
||||
<SolidColorBrush x:Key="DisabledForegroundBrush" Color="#FF4D4D4D" />
|
||||
<SolidColorBrush x:Key="DisabledBackgroundBrush" Color="#EEE" />
|
||||
|
||||
|
||||
<SolidColorBrush x:Key="AlternatingRowBackgroundBrush" Color="#E6E6E6" />
|
||||
<SolidColorBrush x:Key="RowBackgroundBrush" Color="White"/>
|
||||
|
||||
<LinearGradientBrush x:Key="LightBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Color="#FFF" Offset="0.0"/>
|
||||
<GradientStop Color="#EEE" Offset="1.0"/>
|
||||
</GradientStopCollection>
|
||||
</GradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<SolidColorBrush x:Key="ScrollBarBackgroundBrush" Color="#F0F0F0" />
|
||||
<LinearGradientBrush x:Key="GradientWindowBackgroundBrush" EndPoint="1,1" StartPoint="0,0">
|
||||
<GradientStop Color="White" Offset="0"/>
|
||||
<GradientStop Color="#FFF8F8F8" Offset="0.2"/>
|
||||
<GradientStop Color="#FFE3E3E3" Offset="0.75"/>
|
||||
<GradientStop Color="White" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<SolidColorBrush x:Key="HighLightForegroundBrush" Color="#410000" />
|
||||
|
||||
<Color x:Key="UiForegroundColor">Black</Color>
|
||||
<SolidColorBrush x:Key="UiForegroundBrush" Color="{DynamicResource UiForegroundColor}" />
|
||||
|
||||
|
||||
|
||||
|
||||
<Color x:Key="SelectedBackgroundColor">#DEDEDE</Color>
|
||||
<Color x:Key="SelectedUnfocusedColor">#FFB6B6B6</Color>
|
||||
<Color x:Key="ControlLightColor">#FFFFFFFF</Color>
|
||||
<Color x:Key="ControlMediumColor">#FFC5C5C5</Color>
|
||||
<Color x:Key="ControlDarkColor">#FF6B6B6B</Color>
|
||||
|
||||
<Color x:Key="ControlMouseOverColor">#FFCED0E1</Color>
|
||||
<Color x:Key="ControlPressedColor">#FF47909B</Color>
|
||||
|
||||
<Color x:Key="BorderLightColor">#D6D6D6</Color>
|
||||
<Color x:Key="BorderMediumColor">#E6E6E6</Color>
|
||||
|
||||
<!--Window Brushes-->
|
||||
|
||||
<LinearGradientBrush x:Key="WindowHeaderBrush" EndPoint="0,1">
|
||||
<GradientStop Color="#9EF4F4FF" />
|
||||
<GradientStop Color="#80B5BBC6" Offset="0.2" />
|
||||
<GradientStop Color="#93E7E7FC" Offset="0.8" />
|
||||
<GradientStop Color="#A9D4EAFF" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
<SolidColorBrush x:Key="WindowHeaderInactiveBackgroundBrush" Color="#8888" />
|
||||
|
||||
<LinearGradientBrush x:Key="WindowHeaderInactiveBrush" EndPoint="0,1">
|
||||
<GradientStop Color="#A5A5A5" />
|
||||
<GradientStop Color="#FF616161" Offset="0.2" />
|
||||
<GradientStop Color="#FF5C5C5C" Offset="0.8" />
|
||||
<GradientStop Color="#FFBEC5CB" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="WindowBorderBrush" EndPoint="0,1" StartPoint="0,0">
|
||||
<GradientStop Color="#FF898989" Offset="0"/>
|
||||
<GradientStop Color="#FF898989" Offset="1"/>
|
||||
<GradientStop Color="LightGray" Offset="0.841"/>
|
||||
<GradientStop Color="#FFCBCBCB" Offset="0.23"/>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="WindowInnerBorderBrush" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientStop Color="#F0F0F0" Offset="1" />
|
||||
<GradientStop Color="White" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
|
||||
|
||||
|
||||
</ResourceDictionary>
|
||||
41
BrightSharp.NET/Themes/Theme.Static.cs
Normal file
41
BrightSharp.NET/Themes/Theme.Static.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace BrightSharp.Themes
|
||||
{
|
||||
|
||||
internal partial class ThemeStatic
|
||||
{
|
||||
public void CalendarPreviewMouseUp(object sender, MouseEventArgs e) {
|
||||
if (Mouse.Captured is CalendarItem) { Mouse.Capture(null); }
|
||||
}
|
||||
public void DatePickerUnloaded(object sender, RoutedEventArgs e) {
|
||||
if (sender == null) return;
|
||||
DependencyObject child = ((Popup)((DatePicker)sender).Template.FindName("PART_Popup", (FrameworkElement)sender))?.Child;
|
||||
while (child != null && !(child is AdornerDecorator))
|
||||
child = VisualTreeHelper.GetParent(child) ?? LogicalTreeHelper.GetParent(child);
|
||||
if (((AdornerDecorator)child)?.Child is Calendar) ((AdornerDecorator)child).Child = null;
|
||||
}
|
||||
|
||||
|
||||
private void closeButton_Click(object sender, RoutedEventArgs e) {
|
||||
var window = Window.GetWindow((DependencyObject)sender);
|
||||
window.Close();
|
||||
}
|
||||
|
||||
private void maximizeButton_Click(object sender, RoutedEventArgs e) {
|
||||
var window = Window.GetWindow((DependencyObject)sender);
|
||||
window.WindowState = window.WindowState == WindowState.Normal ? WindowState.Maximized : WindowState.Normal;
|
||||
}
|
||||
|
||||
private void minimizeButton_Click(object sender, RoutedEventArgs e) {
|
||||
var window = Window.GetWindow((DependencyObject)sender);
|
||||
window.WindowState = WindowState.Minimized;
|
||||
}
|
||||
}
|
||||
}
|
||||
5729
BrightSharp.NET/Themes/Theme.Static.xaml
Normal file
5729
BrightSharp.NET/Themes/Theme.Static.xaml
Normal file
File diff suppressed because it is too large
Load Diff
40
BrightSharp.NET/Themes/Theme.cs
Normal file
40
BrightSharp.NET/Themes/Theme.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace BrightSharp.Themes
|
||||
{
|
||||
|
||||
internal partial class Theme
|
||||
{
|
||||
public void CalendarPreviewMouseUp(object sender, MouseEventArgs e) {
|
||||
if (Mouse.Captured is CalendarItem) { Mouse.Capture(null); }
|
||||
}
|
||||
public void DatePickerUnloaded(object sender, RoutedEventArgs e) {
|
||||
if (sender == null) return;
|
||||
DependencyObject child = ((Popup)((DatePicker)sender).Template.FindName("PART_Popup", (FrameworkElement)sender))?.Child;
|
||||
while (child != null && !(child is AdornerDecorator))
|
||||
child = VisualTreeHelper.GetParent(child) ?? LogicalTreeHelper.GetParent(child);
|
||||
if (((AdornerDecorator)child)?.Child is Calendar) ((AdornerDecorator)child).Child = null;
|
||||
}
|
||||
|
||||
|
||||
private void closeButton_Click(object sender, RoutedEventArgs e) {
|
||||
var window = Window.GetWindow((DependencyObject)sender);
|
||||
window.Close();
|
||||
}
|
||||
|
||||
private void maximizeButton_Click(object sender, RoutedEventArgs e) {
|
||||
var window = Window.GetWindow((DependencyObject)sender);
|
||||
window.WindowState = window.WindowState == WindowState.Normal ? WindowState.Maximized : WindowState.Normal;
|
||||
}
|
||||
|
||||
private void minimizeButton_Click(object sender, RoutedEventArgs e) {
|
||||
var window = Window.GetWindow((DependencyObject)sender);
|
||||
window.WindowState = WindowState.Minimized;
|
||||
}
|
||||
}
|
||||
}
|
||||
5760
BrightSharp.NET/Themes/Theme.xaml
Normal file
5760
BrightSharp.NET/Themes/Theme.xaml
Normal file
File diff suppressed because it is too large
Load Diff
76
BrightSharp.NET/Themes/ThemeManager.cs
Normal file
76
BrightSharp.NET/Themes/ThemeManager.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace BrightSharp.Themes
|
||||
{
|
||||
public enum ColorThemes
|
||||
{
|
||||
Classic,
|
||||
DevLab,
|
||||
Silver,
|
||||
Blue,
|
||||
DarkBlue
|
||||
}
|
||||
|
||||
public static class ThemeManager
|
||||
{
|
||||
private const string StyleDictionaryPattern = @"(?<=.+style\.)(.*?)(?=\.xaml)";
|
||||
private const string ThemeDictionaryUri = "/brightsharp;component/themes/theme.xaml";
|
||||
|
||||
private static ColorThemes? ThemeField;
|
||||
|
||||
public static ColorThemes? Theme
|
||||
{
|
||||
get {
|
||||
if (ThemeField.HasValue) return ThemeField.Value;
|
||||
var curStyleRes = Resources.Where(r => r.Source != null &&
|
||||
Regex.IsMatch(r.Source.OriginalString, StyleDictionaryPattern, RegexOptions.IgnoreCase)).FirstOrDefault();
|
||||
if (curStyleRes == null) return null;
|
||||
var match = Regex.Match(curStyleRes.Source.OriginalString, StyleDictionaryPattern, RegexOptions.IgnoreCase);
|
||||
ThemeField = (ColorThemes)Enum.Parse(typeof(ColorThemes), match.Value, true);
|
||||
return ThemeField.Value;
|
||||
}
|
||||
set {
|
||||
_ = SetTheme(value);
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task SetTheme(ColorThemes? value, DispatcherPriority priority = DispatcherPriority.Background)
|
||||
{
|
||||
if (ThemeField == value) { return; }
|
||||
ThemeField = value;
|
||||
await Application.Current.Dispatcher.InvokeAsync(() =>
|
||||
{
|
||||
if (ThemeField != value) return;
|
||||
Application.Current.Resources.BeginInit();
|
||||
|
||||
var curStyleRes = Resources.Where(r => r.Source != null &&
|
||||
Regex.IsMatch(r.Source.OriginalString, StyleDictionaryPattern, RegexOptions.IgnoreCase)).FirstOrDefault();
|
||||
var curThemeRes = Resources.Where(r => r.Source != null && r.Source.OriginalString.Equals(ThemeDictionaryUri, StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault();
|
||||
if (curThemeRes != null)
|
||||
Resources.Remove(curThemeRes);
|
||||
if (curStyleRes != null)
|
||||
Resources.Remove(curStyleRes);
|
||||
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(ThemeDictionaryUri, UriKind.RelativeOrAbsolute) });
|
||||
|
||||
Application.Current.Resources.EndInit();
|
||||
ThemeChanged?.Invoke(null, EventArgs.Empty);
|
||||
}, priority);
|
||||
}
|
||||
|
||||
public static event EventHandler ThemeChanged;
|
||||
|
||||
private static ICollection<ResourceDictionary> Resources
|
||||
{
|
||||
get { return Application.Current.Resources.MergedDictionaries; }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
BIN
BrightSharp.NET/Themes/icons/app.png
Normal file
BIN
BrightSharp.NET/Themes/icons/app.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 367 B |
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user