Browse Source

Remove unnecessary parts from EleCho.WpfSuite

pull/3234/head
SlimeNull 11 months ago
parent
commit
0360f8d6d9
  1. 270
      EleCho.WpfSuite/Controls/Border.cs
  2. 14
      EleCho.WpfSuite/Controls/ListBox.cs
  3. 137
      EleCho.WpfSuite/Controls/ListBoxItem.cs
  4. 174
      EleCho.WpfSuite/Controls/ListBoxItemResources.xaml
  5. 13
      EleCho.WpfSuite/Controls/ListBoxResources.xaml
  6. 14
      EleCho.WpfSuite/Controls/ListView.cs
  7. 136
      EleCho.WpfSuite/Controls/ListViewItem.cs
  8. 174
      EleCho.WpfSuite/Controls/ListViewItemResources.xaml
  9. 13
      EleCho.WpfSuite/Controls/ListViewResources.xaml
  10. 113
      EleCho.WpfSuite/Controls/RepeatButton.cs
  11. 150
      EleCho.WpfSuite/Controls/RepeatButtonResources.xaml
  12. 234
      EleCho.WpfSuite/Controls/ScrollBar.cs
  13. 514
      EleCho.WpfSuite/Controls/ScrollBarResources.xaml
  14. 34
      EleCho.WpfSuite/Controls/ScrollViewerResources.xaml
  15. 55
      EleCho.WpfSuite/Controls/Thumb.cs
  16. 34
      EleCho.WpfSuite/Controls/ThumbResources.xaml
  17. 16
      EleCho.WpfSuite/EleCho.WpfSuite.csproj
  18. 11
      EleCho.WpfSuite/Themes/Generic.xaml
  19. 26
      ILSpy/App.xaml
  20. 2
      SharpTreeView/SharpTreeViewItem.cs

270
EleCho.WpfSuite/Controls/Border.cs

@ -1,270 +0,0 @@ @@ -1,270 +0,0 @@
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Media3D;
namespace EleCho.WpfSuite
{
/// <inheritdoc/>
public class Border : System.Windows.Controls.Border
{
/// <summary>
/// A geometry to clip the content of this border correctly
/// </summary>
public Geometry ContentClip
{
get { return (Geometry)GetValue(ContentClipProperty); }
set { SetValue(ContentClipProperty, value); }
}
/// <summary>
/// The key needed set a read-only property
/// </summary>
public static readonly DependencyPropertyKey ContentClipPropertyKey =
DependencyProperty.RegisterReadOnly(nameof(ContentClip), typeof(Geometry), typeof(Border), new PropertyMetadata(default(Geometry)));
/// <summary>
/// The DependencyProperty for the ContentClip property. <br/>
/// Flags: None <br/>
/// Default value: null
/// </summary>
public static readonly DependencyProperty ContentClipProperty =
ContentClipPropertyKey.DependencyProperty;
private Geometry? CalculateContentClip()
{
var borderThickness = BorderThickness;
var cornerRadius = CornerRadius;
var renderSize = RenderSize;
var contentWidth = renderSize.Width - borderThickness.Left - borderThickness.Right;
var contentHeight = renderSize.Height - borderThickness.Top - borderThickness.Bottom;
if (contentWidth > 0 && contentHeight > 0)
{
var rect = new Rect(0, 0, contentWidth, contentHeight);
var radii = new Radii(cornerRadius, borderThickness, false);
var contentGeometry = new StreamGeometry();
using StreamGeometryContext ctx = contentGeometry.Open();
GenerateGeometry(ctx, rect, radii);
contentGeometry.Freeze();
return contentGeometry;
}
else
{
return null;
}
}
/// <inheritdoc/>
protected override void OnRender(DrawingContext dc)
{
SetValue(ContentClipPropertyKey, CalculateContentClip());
base.OnRender(dc);
}
/// <summary>
/// Generates a StreamGeometry.
/// </summary>
/// <param name="ctx">An already opened StreamGeometryContext.</param>
/// <param name="rect">Rectangle for geometry conversion.</param>
/// <param name="radii">Corner radii.</param>
/// <returns>Result geometry.</returns>
private static void GenerateGeometry(StreamGeometryContext ctx, Rect rect, Radii radii)
{
//
// compute the coordinates of the key points
//
Point topLeft = new Point(radii.LeftTop, 0);
Point topRight = new Point(rect.Width - radii.RightTop, 0);
Point rightTop = new Point(rect.Width, radii.TopRight);
Point rightBottom = new Point(rect.Width, rect.Height - radii.BottomRight);
Point bottomRight = new Point(rect.Width - radii.RightBottom, rect.Height);
Point bottomLeft = new Point(radii.LeftBottom, rect.Height);
Point leftBottom = new Point(0, rect.Height - radii.BottomLeft);
Point leftTop = new Point(0, radii.TopLeft);
//
// check key points for overlap and resolve by partitioning radii according to
// the percentage of each one.
//
// top edge is handled here
if (topLeft.X > topRight.X)
{
double v = (radii.LeftTop) / (radii.LeftTop + radii.RightTop) * rect.Width;
topLeft.X = v;
topRight.X = v;
}
// right edge
if (rightTop.Y > rightBottom.Y)
{
double v = (radii.TopRight) / (radii.TopRight + radii.BottomRight) * rect.Height;
rightTop.Y = v;
rightBottom.Y = v;
}
// bottom edge
if (bottomRight.X < bottomLeft.X)
{
double v = (radii.LeftBottom) / (radii.LeftBottom + radii.RightBottom) * rect.Width;
bottomRight.X = v;
bottomLeft.X = v;
}
// left edge
if (leftBottom.Y < leftTop.Y)
{
double v = (radii.TopLeft) / (radii.TopLeft + radii.BottomLeft) * rect.Height;
leftBottom.Y = v;
leftTop.Y = v;
}
//
// add on offsets
//
Vector offset = new Vector(rect.TopLeft.X, rect.TopLeft.Y);
topLeft += offset;
topRight += offset;
rightTop += offset;
rightBottom += offset;
bottomRight += offset;
bottomLeft += offset;
leftBottom += offset;
leftTop += offset;
//
// create the border geometry
//
ctx.BeginFigure(topLeft, true /* is filled */, true /* is closed */);
// Top line
ctx.LineTo(topRight, true /* is stroked */, false /* is smooth join */);
// Upper-right corner
double radiusX = rect.TopRight.X - topRight.X;
double radiusY = rightTop.Y - rect.TopRight.Y;
if (!MathHelper.IsZero(radiusX)
|| !MathHelper.IsZero(radiusY))
{
ctx.ArcTo(rightTop, new Size(radiusX, radiusY), 0, false, SweepDirection.Clockwise, true, false);
}
// Right line
ctx.LineTo(rightBottom, true /* is stroked */, false /* is smooth join */);
// Lower-right corner
radiusX = rect.BottomRight.X - bottomRight.X;
radiusY = rect.BottomRight.Y - rightBottom.Y;
if (!MathHelper.IsZero(radiusX)
|| !MathHelper.IsZero(radiusY))
{
ctx.ArcTo(bottomRight, new Size(radiusX, radiusY), 0, false, SweepDirection.Clockwise, true, false);
}
// Bottom line
ctx.LineTo(bottomLeft, true /* is stroked */, false /* is smooth join */);
// Lower-left corner
radiusX = bottomLeft.X - rect.BottomLeft.X;
radiusY = rect.BottomLeft.Y - leftBottom.Y;
if (!MathHelper.IsZero(radiusX)
|| !MathHelper.IsZero(radiusY))
{
ctx.ArcTo(leftBottom, new Size(radiusX, radiusY), 0, false, SweepDirection.Clockwise, true, false);
}
// Left line
ctx.LineTo(leftTop, true /* is stroked */, false /* is smooth join */);
// Upper-left corner
radiusX = topLeft.X - rect.TopLeft.X;
radiusY = leftTop.Y - rect.TopLeft.Y;
if (!MathHelper.IsZero(radiusX)
|| !MathHelper.IsZero(radiusY))
{
ctx.ArcTo(topLeft, new Size(radiusX, radiusY), 0, false, SweepDirection.Clockwise, true, false);
}
}
private struct Radii
{
internal Radii(CornerRadius radii, Thickness borders, bool outer)
{
double left = 0.5 * borders.Left;
double top = 0.5 * borders.Top;
double right = 0.5 * borders.Right;
double bottom = 0.5 * borders.Bottom;
if (outer)
{
if (MathHelper.IsZero(radii.TopLeft))
{
LeftTop = TopLeft = 0.0;
}
else
{
LeftTop = radii.TopLeft + left;
TopLeft = radii.TopLeft + top;
}
if (MathHelper.IsZero(radii.TopRight))
{
TopRight = RightTop = 0.0;
}
else
{
TopRight = radii.TopRight + top;
RightTop = radii.TopRight + right;
}
if (MathHelper.IsZero(radii.BottomRight))
{
RightBottom = BottomRight = 0.0;
}
else
{
RightBottom = radii.BottomRight + right;
BottomRight = radii.BottomRight + bottom;
}
if (MathHelper.IsZero(radii.BottomLeft))
{
BottomLeft = LeftBottom = 0.0;
}
else
{
BottomLeft = radii.BottomLeft + bottom;
LeftBottom = radii.BottomLeft + left;
}
}
else
{
LeftTop = Math.Max(0.0, radii.TopLeft - left);
TopLeft = Math.Max(0.0, radii.TopLeft - top);
TopRight = Math.Max(0.0, radii.TopRight - top);
RightTop = Math.Max(0.0, radii.TopRight - right);
RightBottom = Math.Max(0.0, radii.BottomRight - right);
BottomRight = Math.Max(0.0, radii.BottomRight - bottom);
BottomLeft = Math.Max(0.0, radii.BottomLeft - bottom);
LeftBottom = Math.Max(0.0, radii.BottomLeft - left);
}
}
internal double LeftTop;
internal double TopLeft;
internal double TopRight;
internal double RightTop;
internal double RightBottom;
internal double BottomRight;
internal double BottomLeft;
internal double LeftBottom;
}
}
}

14
EleCho.WpfSuite/Controls/ListBox.cs

@ -51,23 +51,11 @@ namespace EleCho.WpfSuite @@ -51,23 +51,11 @@ namespace EleCho.WpfSuite
set { SetValue(DisabledBorderBrushProperty, value); }
}
/// <inheritdoc/>
protected override DependencyObject GetContainerForItemOverride()
{
return new ListBoxItem();
}
/// <inheritdoc/>
protected override bool IsItemItsOwnContainerOverride(object item)
{
return item is ListBoxItem;
}
/// <summary>
/// DependencyProperty of <see cref="CornerRadius"/> property
/// </summary>
public static readonly DependencyProperty CornerRadiusProperty =
Border.CornerRadiusProperty.AddOwner(typeof(ListBox));
System.Windows.Controls.Border.CornerRadiusProperty.AddOwner(typeof(ListBox));
/// <summary>
/// The DependencyProperty of <see cref="DisabledBackground"/> property

137
EleCho.WpfSuite/Controls/ListBoxItem.cs

@ -1,137 +0,0 @@ @@ -1,137 +0,0 @@
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
namespace EleCho.WpfSuite
{
public class ListBoxItem : System.Windows.Controls.ListBoxItem
{
static ListBoxItem()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(ListBoxItem), new FrameworkPropertyMetadata(typeof(ListBoxItem)));
}
/// <summary>
/// The CornerRadius property allows users to control the roundness of the corners independently by
/// setting a radius value for each corner. Radius values that are too large are scaled so that they
/// smoothly blend from corner to corner.
/// </summary>
public CornerRadius CornerRadius
{
get { return (CornerRadius)GetValue(CornerRadiusProperty); }
set { SetValue(CornerRadiusProperty, value); }
}
public Brush HoverForeground
{
get { return (Brush)GetValue(HoverForegroundProperty); }
set { SetValue(HoverForegroundProperty, value); }
}
public Brush HoverBackground
{
get { return (Brush)GetValue(HoverBackgroundProperty); }
set { SetValue(HoverBackgroundProperty, value); }
}
public Brush HoverBorderBrush
{
get { return (Brush)GetValue(HoverBorderBrushProperty); }
set { SetValue(HoverBorderBrushProperty, value); }
}
public Brush SelectedForeground
{
get { return (Brush)GetValue(SelectedForegroundProperty); }
set { SetValue(SelectedForegroundProperty, value); }
}
public Brush SelectedBackground
{
get { return (Brush)GetValue(SelectedBackgroundProperty); }
set { SetValue(SelectedBackgroundProperty, value); }
}
public Brush SelectedBorderBrush
{
get { return (Brush)GetValue(SelectedBorderBrushProperty); }
set { SetValue(SelectedBorderBrushProperty, value); }
}
public Brush SelectedActiveForeground
{
get { return (Brush)GetValue(SelectedActiveForegroundProperty); }
set { SetValue(SelectedActiveForegroundProperty, value); }
}
public Brush SelectedActiveBackground
{
get { return (Brush)GetValue(SelectedActiveBackgroundProperty); }
set { SetValue(SelectedActiveBackgroundProperty, value); }
}
public Brush SelectedActiveBorderBrush
{
get { return (Brush)GetValue(SelectedActiveBorderBrushProperty); }
set { SetValue(SelectedActiveBorderBrushProperty, value); }
}
public Brush DisabledForeground
{
get { return (Brush)GetValue(DisabledForegroundProperty); }
set { SetValue(DisabledForegroundProperty, value); }
}
public Brush DisabledBackground
{
get { return (Brush)GetValue(DisabledBackgroundProperty); }
set { SetValue(DisabledBackgroundProperty, value); }
}
public Brush DisabledBorderBrush
{
get { return (Brush)GetValue(DisabledBorderBrushProperty); }
set { SetValue(DisabledBorderBrushProperty, value); }
}
public static readonly DependencyProperty CornerRadiusProperty =
Border.CornerRadiusProperty.AddOwner(typeof(ListBoxItem));
public static readonly DependencyProperty HoverForegroundProperty =
DependencyProperty.Register(nameof(HoverForeground), typeof(Brush), typeof(ListBoxItem), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty HoverBackgroundProperty =
DependencyProperty.Register(nameof(HoverBackground), typeof(Brush), typeof(ListBoxItem), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty HoverBorderBrushProperty =
DependencyProperty.Register(nameof(HoverBorderBrush), typeof(Brush), typeof(ListBoxItem), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty SelectedForegroundProperty =
DependencyProperty.Register(nameof(SelectedForeground), typeof(Brush), typeof(ListBoxItem), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty SelectedBackgroundProperty =
DependencyProperty.Register(nameof(SelectedBackground), typeof(Brush), typeof(ListBoxItem), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty SelectedBorderBrushProperty =
DependencyProperty.Register(nameof(SelectedBorderBrush), typeof(Brush), typeof(ListBoxItem), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty SelectedActiveForegroundProperty =
DependencyProperty.Register(nameof(SelectedActiveForeground), typeof(Brush), typeof(ListBoxItem), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty SelectedActiveBackgroundProperty =
DependencyProperty.Register(nameof(SelectedActiveBackground), typeof(Brush), typeof(ListBoxItem), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty SelectedActiveBorderBrushProperty =
DependencyProperty.Register(nameof(SelectedActiveBorderBrush), typeof(Brush), typeof(ListBoxItem), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty DisabledForegroundProperty =
DependencyProperty.Register(nameof(DisabledForeground), typeof(Brush), typeof(ListBoxItem), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty DisabledBackgroundProperty =
DependencyProperty.Register(nameof(DisabledBackground), typeof(Brush), typeof(ListBoxItem), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty DisabledBorderBrushProperty =
DependencyProperty.Register(nameof(DisabledBorderBrush), typeof(Brush), typeof(ListBoxItem), new FrameworkPropertyMetadata(null));
}
}

174
EleCho.WpfSuite/Controls/ListBoxItemResources.xaml

@ -1,174 +0,0 @@ @@ -1,174 +0,0 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ws="https://schemas.elecho.dev/wpfsuite">
<Style x:Key="FocusVisual">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Margin="2" StrokeDashArray="1 2" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" SnapsToDevicePixels="true" StrokeThickness="1"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type ws:ListBoxItem}">
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="Padding" Value="4,1"/>
<Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
<Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="HoverBackground" Value="#1F26A0DA"/>
<Setter Property="HoverBorderBrush" Value="#a826A0Da"/>
<Setter Property="SelectedBackground" Value="#3DDADADA"/>
<Setter Property="SelectedBorderBrush" Value="#FFDADADA"/>
<Setter Property="SelectedActiveBackground" Value="#3D26A0DA"/>
<Setter Property="SelectedActiveBorderBrush" Value="#FF26A0DA"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ws:ListBoxItem}">
<ws:Border x:Name="Bd"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
Padding="{TemplateBinding Padding}"
SnapsToDevicePixels="true">
<ContentPresenter x:Name="PART_ContentPresenter"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</ws:Border>
<ControlTemplate.Triggers>
<Trigger Property="ClipToBounds" Value="True">
<Setter TargetName="PART_ContentPresenter"
Property="Clip"
Value="{Binding ElementName=Bd,Path=ContentClip}"/>
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="True"/>
</MultiTrigger.Conditions>
<Setter Property="Background" TargetName="Bd">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="HoverBackground"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Background"/>
</MultiBinding>
</Setter.Value>
</Setter>
<Setter Property="BorderBrush" TargetName="Bd">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="HoverBorderBrush"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="BorderBrush"/>
</MultiBinding>
</Setter.Value>
</Setter>
<Setter Property="TextElement.Foreground" TargetName="PART_ContentPresenter">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="HoverForeground"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Foreground"/>
</MultiBinding>
</Setter.Value>
</Setter>
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="Selector.IsSelectionActive" Value="False"/>
<Condition Property="IsSelected" Value="True"/>
</MultiTrigger.Conditions>
<Setter Property="Background" TargetName="Bd">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="SelectedBackground"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Background"/>
</MultiBinding>
</Setter.Value>
</Setter>
<Setter Property="BorderBrush" TargetName="Bd">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="SelectedBorderBrush"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="BorderBrush"/>
</MultiBinding>
</Setter.Value>
</Setter>
<Setter Property="TextElement.Foreground" TargetName="PART_ContentPresenter">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="SelectedForeground"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Foreground"/>
</MultiBinding>
</Setter.Value>
</Setter>
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="Selector.IsSelectionActive" Value="True"/>
<Condition Property="IsSelected" Value="True"/>
</MultiTrigger.Conditions>
<Setter Property="Background" TargetName="Bd">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="SelectedActiveBackground"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="SelectedBackground"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Background"/>
</MultiBinding>
</Setter.Value>
</Setter>
<Setter Property="BorderBrush" TargetName="Bd">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="SelectedActiveBorderBrush"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="SelectedBorderBrush"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="BorderBrush"/>
</MultiBinding>
</Setter.Value>
</Setter>
<Setter Property="TextElement.Foreground" TargetName="PART_ContentPresenter">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="SelectedActiveForeground"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="SelectedForeground"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Foreground"/>
</MultiBinding>
</Setter.Value>
</Setter>
</MultiTrigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" TargetName="Bd">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="DisabledBackground"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Background"/>
</MultiBinding>
</Setter.Value>
</Setter>
<Setter Property="BorderBrush" TargetName="Bd">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="DisabledBorderBrush"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="BorderBrush"/>
</MultiBinding>
</Setter.Value>
</Setter>
<Setter Property="TextElement.Foreground" TargetName="PART_ContentPresenter">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="DisabledForeground"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Foreground"/>
</MultiBinding>
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

13
EleCho.WpfSuite/Controls/ListBoxResources.xaml

@ -22,7 +22,7 @@ @@ -22,7 +22,7 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ws:ListBox}">
<ws:Border x:Name="Part_BD"
<Border x:Name="Part_BD"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
@ -33,14 +33,9 @@ @@ -33,14 +33,9 @@
Focusable="false" Padding="{TemplateBinding Padding}">
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</ws:ScrollViewer>
</ws:Border>
<ControlTemplate.Triggers>
<Trigger Property="ClipToBounds" Value="True">
<Setter TargetName="PART_Content"
Property="Clip"
Value="{Binding ElementName=Part_BD,Path=ContentClip}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Part_BD" Property="Background">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">

14
EleCho.WpfSuite/Controls/ListView.cs

@ -41,24 +41,12 @@ namespace EleCho.WpfSuite @@ -41,24 +41,12 @@ namespace EleCho.WpfSuite
set { SetValue(DisabledBorderBrushProperty, value); }
}
/// <inheritdoc/>
protected override DependencyObject GetContainerForItemOverride()
{
return new ListViewItem();
}
/// <inheritdoc/>
protected override bool IsItemItsOwnContainerOverride(object item)
{
return item is ListViewItem;
}
/// <summary>
/// DependencyProperty of <see cref="CornerRadius"/> property
/// </summary>
public static readonly DependencyProperty CornerRadiusProperty =
Border.CornerRadiusProperty.AddOwner(typeof(ListView));
System.Windows.Controls.Border.CornerRadiusProperty.AddOwner(typeof(ListView));
/// <summary>
/// The DependencyProperty of <see cref="DisabledBackground"/> property

136
EleCho.WpfSuite/Controls/ListViewItem.cs

@ -1,136 +0,0 @@ @@ -1,136 +0,0 @@
using System.Windows;
using System.Windows.Media;
namespace EleCho.WpfSuite
{
public class ListViewItem : System.Windows.Controls.ListViewItem
{
static ListViewItem()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(ListViewItem), new FrameworkPropertyMetadata(typeof(ListViewItem)));
}
/// <summary>
/// The CornerRadius property allows users to control the roundness of the corners independently by
/// setting a radius value for each corner. Radius values that are too large are scaled so that they
/// smoothly blend from corner to corner.
/// </summary>
public CornerRadius CornerRadius
{
get { return (CornerRadius)GetValue(CornerRadiusProperty); }
set { SetValue(CornerRadiusProperty, value); }
}
public Brush HoverForeground
{
get { return (Brush)GetValue(HoverForegroundProperty); }
set { SetValue(HoverForegroundProperty, value); }
}
public Brush HoverBackground
{
get { return (Brush)GetValue(HoverBackgroundProperty); }
set { SetValue(HoverBackgroundProperty, value); }
}
public Brush HoverBorderBrush
{
get { return (Brush)GetValue(HoverBorderBrushProperty); }
set { SetValue(HoverBorderBrushProperty, value); }
}
public Brush SelectedForeground
{
get { return (Brush)GetValue(SelectedForegroundProperty); }
set { SetValue(SelectedForegroundProperty, value); }
}
public Brush SelectedBackground
{
get { return (Brush)GetValue(SelectedBackgroundProperty); }
set { SetValue(SelectedBackgroundProperty, value); }
}
public Brush SelectedBorderBrush
{
get { return (Brush)GetValue(SelectedBorderBrushProperty); }
set { SetValue(SelectedBorderBrushProperty, value); }
}
public Brush SelectedActiveForeground
{
get { return (Brush)GetValue(SelectedActiveForegroundProperty); }
set { SetValue(SelectedActiveForegroundProperty, value); }
}
public Brush SelectedActiveBackground
{
get { return (Brush)GetValue(SelectedActiveBackgroundProperty); }
set { SetValue(SelectedActiveBackgroundProperty, value); }
}
public Brush SelectedActiveBorderBrush
{
get { return (Brush)GetValue(SelectedActiveBorderBrushProperty); }
set { SetValue(SelectedActiveBorderBrushProperty, value); }
}
public Brush DisabledForeground
{
get { return (Brush)GetValue(DisabledForegroundProperty); }
set { SetValue(DisabledForegroundProperty, value); }
}
public Brush DisabledBackground
{
get { return (Brush)GetValue(DisabledBackgroundProperty); }
set { SetValue(DisabledBackgroundProperty, value); }
}
public Brush DisabledBorderBrush
{
get { return (Brush)GetValue(DisabledBorderBrushProperty); }
set { SetValue(DisabledBorderBrushProperty, value); }
}
public static readonly DependencyProperty CornerRadiusProperty =
Border.CornerRadiusProperty.AddOwner(typeof(ListViewItem));
public static readonly DependencyProperty HoverForegroundProperty =
DependencyProperty.Register(nameof(HoverForeground), typeof(Brush), typeof(ListViewItem), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty HoverBackgroundProperty =
DependencyProperty.Register(nameof(HoverBackground), typeof(Brush), typeof(ListViewItem), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty HoverBorderBrushProperty =
DependencyProperty.Register(nameof(HoverBorderBrush), typeof(Brush), typeof(ListViewItem), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty SelectedForegroundProperty =
DependencyProperty.Register(nameof(SelectedForeground), typeof(Brush), typeof(ListViewItem), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty SelectedBackgroundProperty =
DependencyProperty.Register(nameof(SelectedBackground), typeof(Brush), typeof(ListViewItem), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty SelectedBorderBrushProperty =
DependencyProperty.Register(nameof(SelectedBorderBrush), typeof(Brush), typeof(ListViewItem), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty SelectedActiveForegroundProperty =
DependencyProperty.Register(nameof(SelectedActiveForeground), typeof(Brush), typeof(ListViewItem), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty SelectedActiveBackgroundProperty =
DependencyProperty.Register(nameof(SelectedActiveBackground), typeof(Brush), typeof(ListViewItem), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty SelectedActiveBorderBrushProperty =
DependencyProperty.Register(nameof(SelectedActiveBorderBrush), typeof(Brush), typeof(ListViewItem), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty DisabledForegroundProperty =
DependencyProperty.Register(nameof(DisabledForeground), typeof(Brush), typeof(ListViewItem), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty DisabledBackgroundProperty =
DependencyProperty.Register(nameof(DisabledBackground), typeof(Brush), typeof(ListViewItem), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty DisabledBorderBrushProperty =
DependencyProperty.Register(nameof(DisabledBorderBrush), typeof(Brush), typeof(ListViewItem), new FrameworkPropertyMetadata(null));
}
}

174
EleCho.WpfSuite/Controls/ListViewItemResources.xaml

@ -1,174 +0,0 @@ @@ -1,174 +0,0 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ws="https://schemas.elecho.dev/wpfsuite">
<Style x:Key="FocusVisual">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Margin="2" StrokeDashArray="1 2" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" SnapsToDevicePixels="true" StrokeThickness="1"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type ws:ListViewItem}">
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="Padding" Value="4,1"/>
<Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
<Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="HoverBackground" Value="#1F26A0DA"/>
<Setter Property="HoverBorderBrush" Value="#a826A0Da"/>
<Setter Property="SelectedBackground" Value="#3DDADADA"/>
<Setter Property="SelectedBorderBrush" Value="#FFDADADA"/>
<Setter Property="SelectedActiveBackground" Value="#3D26A0DA"/>
<Setter Property="SelectedActiveBorderBrush" Value="#FF26A0DA"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ws:ListViewItem}">
<ws:Border x:Name="Bd"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
Padding="{TemplateBinding Padding}"
SnapsToDevicePixels="true">
<ContentPresenter x:Name="PART_ContentPresenter"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</ws:Border>
<ControlTemplate.Triggers>
<Trigger Property="ClipToBounds" Value="True">
<Setter TargetName="PART_ContentPresenter"
Property="Clip"
Value="{Binding ElementName=Bd,Path=ContentClip}"/>
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="True"/>
</MultiTrigger.Conditions>
<Setter Property="Background" TargetName="Bd">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="HoverBackground"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Background"/>
</MultiBinding>
</Setter.Value>
</Setter>
<Setter Property="BorderBrush" TargetName="Bd">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="HoverBorderBrush"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="BorderBrush"/>
</MultiBinding>
</Setter.Value>
</Setter>
<Setter Property="TextElement.Foreground" TargetName="PART_ContentPresenter">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="HoverForeground"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Foreground"/>
</MultiBinding>
</Setter.Value>
</Setter>
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="Selector.IsSelectionActive" Value="False"/>
<Condition Property="IsSelected" Value="True"/>
</MultiTrigger.Conditions>
<Setter Property="Background" TargetName="Bd">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="SelectedBackground"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Background"/>
</MultiBinding>
</Setter.Value>
</Setter>
<Setter Property="BorderBrush" TargetName="Bd">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="SelectedBorderBrush"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="BorderBrush"/>
</MultiBinding>
</Setter.Value>
</Setter>
<Setter Property="TextElement.Foreground" TargetName="PART_ContentPresenter">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="SelectedForeground"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Foreground"/>
</MultiBinding>
</Setter.Value>
</Setter>
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="Selector.IsSelectionActive" Value="True"/>
<Condition Property="IsSelected" Value="True"/>
</MultiTrigger.Conditions>
<Setter Property="Background" TargetName="Bd">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="SelectedActiveBackground"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="SelectedBackground"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Background"/>
</MultiBinding>
</Setter.Value>
</Setter>
<Setter Property="BorderBrush" TargetName="Bd">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="SelectedActiveBorderBrush"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="SelectedBorderBrush"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="BorderBrush"/>
</MultiBinding>
</Setter.Value>
</Setter>
<Setter Property="TextElement.Foreground" TargetName="PART_ContentPresenter">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="SelectedActiveForeground"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="SelectedForeground"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Foreground"/>
</MultiBinding>
</Setter.Value>
</Setter>
</MultiTrigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" TargetName="Bd">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="DisabledBackground"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Background"/>
</MultiBinding>
</Setter.Value>
</Setter>
<Setter Property="BorderBrush" TargetName="Bd">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="DisabledBorderBrush"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="BorderBrush"/>
</MultiBinding>
</Setter.Value>
</Setter>
<Setter Property="TextElement.Foreground" TargetName="PART_ContentPresenter">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="DisabledForeground"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Foreground"/>
</MultiBinding>
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

13
EleCho.WpfSuite/Controls/ListViewResources.xaml

@ -22,7 +22,7 @@ @@ -22,7 +22,7 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ws:ListView}">
<ws:Border x:Name="Part_BD"
<Border x:Name="Part_BD"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
@ -33,14 +33,9 @@ @@ -33,14 +33,9 @@
Focusable="false" Padding="{TemplateBinding Padding}">
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</ws:ScrollViewer>
</ws:Border>
<ControlTemplate.Triggers>
<Trigger Property="ClipToBounds" Value="True">
<Setter TargetName="PART_Content"
Property="Clip"
Value="{Binding ElementName=Part_BD,Path=ContentClip}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Part_BD" Property="Background">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">

113
EleCho.WpfSuite/Controls/RepeatButton.cs

@ -1,113 +0,0 @@ @@ -1,113 +0,0 @@
using System.Windows;
using System.Windows.Media;
namespace EleCho.WpfSuite
{
public class RepeatButton : System.Windows.Controls.Primitives.RepeatButton
{
static RepeatButton()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(RepeatButton), new FrameworkPropertyMetadata(typeof(RepeatButton)));
}
public CornerRadius CornerRadius
{
get { return (CornerRadius)GetValue(CornerRadiusProperty); }
set { SetValue(CornerRadiusProperty, value); }
}
public Brush HoverForeground
{
get { return (Brush)GetValue(HoverForegroundProperty); }
set { SetValue(HoverForegroundProperty, value); }
}
public Brush HoverBackground
{
get { return (Brush)GetValue(HoverBackgroundProperty); }
set { SetValue(HoverBackgroundProperty, value); }
}
public Brush HoverBorderBrush
{
get { return (Brush)GetValue(HoverBorderBrushProperty); }
set { SetValue(HoverBorderBrushProperty, value); }
}
public Brush PressedForeground
{
get { return (Brush)GetValue(PressedForegroundProperty); }
set { SetValue(PressedForegroundProperty, value); }
}
public Brush PressedBackground
{
get { return (Brush)GetValue(PressedBackgroundProperty); }
set { SetValue(PressedBackgroundProperty, value); }
}
public Brush PressedBorderBrush
{
get { return (Brush)GetValue(PressedBorderBrushProperty); }
set { SetValue(PressedBorderBrushProperty, value); }
}
public Brush DisabledForeground
{
get { return (Brush)GetValue(DisabledForegroundProperty); }
set { SetValue(DisabledForegroundProperty, value); }
}
public Brush DisabledBackground
{
get { return (Brush)GetValue(DisabledBackgroundProperty); }
set { SetValue(DisabledBackgroundProperty, value); }
}
public Brush DisabledBorderBrush
{
get { return (Brush)GetValue(DisabledBorderBrushProperty); }
set { SetValue(DisabledBorderBrushProperty, value); }
}
public Brush HighlightBrush
{
get { return (Brush)GetValue(HighlightBrushProperty); }
set { SetValue(HighlightBrushProperty, value); }
}
public static readonly DependencyProperty CornerRadiusProperty =
Border.CornerRadiusProperty.AddOwner(typeof(RepeatButton));
public static readonly DependencyProperty HoverForegroundProperty =
DependencyProperty.Register(nameof(HoverForeground), typeof(Brush), typeof(RepeatButton), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty HoverBackgroundProperty =
DependencyProperty.Register(nameof(HoverBackground), typeof(Brush), typeof(RepeatButton), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty HoverBorderBrushProperty =
DependencyProperty.Register(nameof(HoverBorderBrush), typeof(Brush), typeof(RepeatButton), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty PressedForegroundProperty =
DependencyProperty.Register(nameof(PressedForeground), typeof(Brush), typeof(RepeatButton), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty PressedBackgroundProperty =
DependencyProperty.Register(nameof(PressedBackground), typeof(Brush), typeof(RepeatButton), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty PressedBorderBrushProperty =
DependencyProperty.Register(nameof(PressedBorderBrush), typeof(Brush), typeof(RepeatButton), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty DisabledForegroundProperty =
DependencyProperty.Register(nameof(DisabledForeground), typeof(Brush), typeof(RepeatButton), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty DisabledBackgroundProperty =
DependencyProperty.Register(nameof(DisabledBackground), typeof(Brush), typeof(RepeatButton), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty DisabledBorderBrushProperty =
DependencyProperty.Register(nameof(DisabledBorderBrush), typeof(Brush), typeof(RepeatButton), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty HighlightBrushProperty =
DependencyProperty.Register(nameof(HighlightBrush), typeof(Brush), typeof(RepeatButton), new FrameworkPropertyMetadata(SystemColors.HighlightBrush));
}
}

150
EleCho.WpfSuite/Controls/RepeatButtonResources.xaml

@ -1,150 +0,0 @@ @@ -1,150 +0,0 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ws="https://schemas.elecho.dev/wpfsuite">
<Style x:Key="FocusVisual">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Margin="2" StrokeDashArray="1 2" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" SnapsToDevicePixels="true" StrokeThickness="1"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type ws:RepeatButton}">
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
<Setter Property="Background" Value="#FFDDDDDD"/>
<Setter Property="BorderBrush" Value="#FF707070"/>
<Setter Property="HoverBackground" Value="#FFBEE6FD"/>
<Setter Property="HoverBorderBrush" Value="#FF3C7FB1"/>
<Setter Property="PressedBackground" Value="#FFC4E5F6"/>
<Setter Property="PressedBorderBrush" Value="#FF2C628B"/>
<Setter Property="DisabledBackground" Value="#FFF4F4F4"/>
<Setter Property="DisabledBorderBrush" Value="#FFADB2B5"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Setter Property="DisabledForeground" Value="#FF838383"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ws:RepeatButton}">
<ws:Border x:Name="border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
SnapsToDevicePixels="true">
<ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</ws:Border>
<ControlTemplate.Triggers>
<Trigger Property="ClipToBounds" Value="True">
<Setter TargetName="contentPresenter"
Property="Clip"
Value="{Binding ElementName=border,Path=ContentClip}"/>
</Trigger>
<Trigger Property="Button.IsDefaulted" Value="true">
<Setter Property="BorderBrush" TargetName="border">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="HighlightBrush"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="BorderBrush"/>
</MultiBinding>
</Setter.Value>
</Setter>
</Trigger>
<!--Hover styles bellow-->
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="Background">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="HoverBackground"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Background"/>
</MultiBinding>
</Setter.Value>
</Setter>
<Setter TargetName="border" Property="BorderBrush">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="HoverBorderBrush"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="BorderBrush"/>
</MultiBinding>
</Setter.Value>
</Setter>
<Setter TargetName="contentPresenter" Property="TextElement.Foreground">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="HoverForeground"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Foreground"/>
</MultiBinding>
</Setter.Value>
</Setter>
</Trigger>
<!--Pressed styles bellow-->
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="border" Property="Background">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="PressedBackground"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Background"/>
</MultiBinding>
</Setter.Value>
</Setter>
<Setter TargetName="border" Property="BorderBrush">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="PressedBorderBrush"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="BorderBrush"/>
</MultiBinding>
</Setter.Value>
</Setter>
<Setter TargetName="contentPresenter" Property="TextElement.Foreground">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="PressedForeground"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Foreground"/>
</MultiBinding>
</Setter.Value>
</Setter>
</Trigger>
<!--Disabled styles bellow-->
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="border" Property="Background">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="DisabledBackground"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Background"/>
</MultiBinding>
</Setter.Value>
</Setter>
<Setter TargetName="border" Property="BorderBrush">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="DisabledBorderBrush"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="BorderBrush"/>
</MultiBinding>
</Setter.Value>
</Setter>
<Setter TargetName="contentPresenter" Property="TextElement.Foreground">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="DisabledForeground"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Foreground"/>
</MultiBinding>
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

234
EleCho.WpfSuite/Controls/ScrollBar.cs

@ -1,234 +0,0 @@ @@ -1,234 +0,0 @@
using System.Windows;
using System.Windows.Media;
namespace EleCho.WpfSuite
{
public class ScrollBar : System.Windows.Controls.Primitives.ScrollBar
{
private static readonly Brush s_thumbBrush =new SolidColorBrush(Color.FromRgb(205, 205, 205));
private static readonly Brush s_glyphBrush= new SolidColorBrush(Color.FromRgb(96, 96, 96));
private static readonly Brush s_disabledGlyphBrush =new SolidColorBrush(Color.FromRgb(112, 112, 112));
private static readonly Geometry s_glyphLeft = Geometry.Parse("M 3.18,7 C3.18,7 5,7 5,7 5,7 1.81,3.5 1.81,3.5 1.81,3.5 5,0 5,0 5,0 3.18,0 3.18,0 3.18,0 0,3.5 0,3.5 0,3.5 3.18,7 3.18,7 z");
private static readonly Geometry s_glyphRight = Geometry.Parse("M 1.81,7 C1.81,7 0,7 0,7 0,7 3.18,3.5 3.18,3.5 3.18,3.5 0,0 0,0 0,0 1.81,0 1.81,0 1.81,0 5,3.5 5,3.5 5,3.5 1.81,7 1.81,7 z");
private static readonly Geometry s_glyphUp = Geometry.Parse("M 0,4 C0,4 0,6 0,6 0,6 3.5,2.5 3.5,2.5 3.5,2.5 7,6 7,6 7,6 7,4 7,4 7,4 3.5,0.5 3.5,0.5 3.5,0.5 0,4 0,4 z");
private static readonly Geometry s_glyphDown = Geometry.Parse("M 0,2.5 C0,2.5 0,0.5 0,0.5 0,0.5 3.5,4 3.5,4 3.5,4 7,0.5 7,0.5 7,0.5 7,2.5 7,2.5 7,2.5 3.5,6 3.5,6 3.5,6 0,2.5 0,2.5 z");
static ScrollBar()
{
s_thumbBrush.Freeze();
s_glyphBrush.Freeze();
s_disabledGlyphBrush.Freeze();
s_glyphLeft.Freeze();
s_glyphRight.Freeze();
s_glyphUp.Freeze();
s_glyphDown.Freeze();
DefaultStyleKeyProperty.OverrideMetadata(typeof(ScrollBar), new FrameworkPropertyMetadata(typeof(ScrollBar)));
}
public CornerRadius CornerRadius
{
get { return (CornerRadius)GetValue(CornerRadiusProperty); }
set { SetValue(CornerRadiusProperty, value); }
}
public CornerRadius ThumbCornerRadius
{
get { return (CornerRadius)GetValue(ThumbCornerRadiusProperty); }
set { SetValue(ThumbCornerRadiusProperty, value); }
}
public CornerRadius ButtonCornerRadius
{
get { return (CornerRadius)GetValue(ButtonCornerRadiusProperty); }
set { SetValue(ButtonCornerRadiusProperty, value); }
}
public Thickness GlyphMargin
{
get { return (Thickness)GetValue(GlyphMarginProperty); }
set { SetValue(GlyphMarginProperty, value); }
}
public Geometry? ArrowLeftGlyph
{
get { return (Geometry?)GetValue(ArrowLeftGlyphProperty); }
set { SetValue(ArrowLeftGlyphProperty, value); }
}
public Geometry? ArrowRightGlyph
{
get { return (Geometry?)GetValue(ArrowRightGlyphProperty); }
set { SetValue(ArrowRightGlyphProperty, value); }
}
public Geometry? ArrowUpGlyph
{
get { return (Geometry?)GetValue(ArrowUpGlyphProperty); }
set { SetValue(ArrowUpGlyphProperty, value); }
}
public Geometry? ArrowDownGlyph
{
get { return (Geometry?)GetValue(ArrowDownGlyphProperty); }
set { SetValue(ArrowDownGlyphProperty, value); }
}
public Brush ThumbBrush
{
get { return (Brush)GetValue(ThumbBrushProperty); }
set { SetValue(ThumbBrushProperty, value); }
}
public Brush GlyphBrush
{
get { return (Brush)GetValue(GlyphBrushProperty); }
set { SetValue(GlyphBrushProperty, value); }
}
public Brush HoverBackground
{
get { return (Brush)GetValue(HoverBackgroundProperty); }
set { SetValue(HoverBackgroundProperty, value); }
}
public Brush HoverBorderBrush
{
get { return (Brush)GetValue(HoverBorderBrushProperty); }
set { SetValue(HoverBorderBrushProperty, value); }
}
public Brush HoverThumbBrush
{
get { return (Brush)GetValue(HoverThumbBrushProperty); }
set { SetValue(HoverThumbBrushProperty, value); }
}
public Brush HoverGlyphBrush
{
get { return (Brush)GetValue(HoverGlyphBrushProperty); }
set { SetValue(HoverGlyphBrushProperty, value); }
}
public Brush PressedBackground
{
get { return (Brush)GetValue(PressedBackgroundProperty); }
set { SetValue(PressedBackgroundProperty, value); }
}
public Brush PressedBorderBrush
{
get { return (Brush)GetValue(PressedBorderBrushProperty); }
set { SetValue(PressedBorderBrushProperty, value); }
}
public Brush PressedThumbBrush
{
get { return (Brush)GetValue(PressedThumbBrushProperty); }
set { SetValue(PressedThumbBrushProperty, value); }
}
public Brush PressedGlyphBrush
{
get { return (Brush)GetValue(PressedGlyphBrushProperty); }
set { SetValue(PressedGlyphBrushProperty, value); }
}
public Brush DisabledBackground
{
get { return (Brush)GetValue(DisabledBackgroundProperty); }
set { SetValue(DisabledBackgroundProperty, value); }
}
public Brush DisabledBorderBrush
{
get { return (Brush)GetValue(DisabledBorderBrushProperty); }
set { SetValue(DisabledBorderBrushProperty, value); }
}
public Brush DisabledThumbBrush
{
get { return (Brush)GetValue(DisabledThumbBrushProperty); }
set { SetValue(DisabledThumbBrushProperty, value); }
}
public Brush DisabledGlyphBrush
{
get { return (Brush)GetValue(DisabledGlyphBrushProperty); }
set { SetValue(DisabledGlyphBrushProperty, value); }
}
public static readonly DependencyProperty CornerRadiusProperty =
Border.CornerRadiusProperty.AddOwner(typeof(ScrollBar));
public static readonly DependencyProperty ThumbCornerRadiusProperty =
DependencyProperty.Register(nameof(ThumbCornerRadius), typeof(CornerRadius), typeof(ScrollBar), new FrameworkPropertyMetadata(new CornerRadius(0)));
public static readonly DependencyProperty ButtonCornerRadiusProperty =
DependencyProperty.Register(nameof(ButtonCornerRadius), typeof(CornerRadius), typeof(ScrollBar), new FrameworkPropertyMetadata(new CornerRadius(0)));
public static readonly DependencyProperty GlyphMarginProperty =
DependencyProperty.Register(nameof(GlyphMargin), typeof(Thickness), typeof(ScrollBar), new FrameworkPropertyMetadata(new Thickness(3)));
public static readonly DependencyProperty ArrowLeftGlyphProperty =
DependencyProperty.Register(nameof(ArrowLeftGlyph), typeof(Geometry), typeof(ScrollBar), new FrameworkPropertyMetadata(s_glyphLeft));
public static readonly DependencyProperty ArrowRightGlyphProperty =
DependencyProperty.Register(nameof(ArrowRightGlyph), typeof(Geometry), typeof(ScrollBar), new FrameworkPropertyMetadata(s_glyphRight));
public static readonly DependencyProperty ArrowUpGlyphProperty =
DependencyProperty.Register(nameof(ArrowUpGlyph), typeof(Geometry), typeof(ScrollBar), new FrameworkPropertyMetadata(s_glyphUp));
public static readonly DependencyProperty ArrowDownGlyphProperty =
DependencyProperty.Register(nameof(ArrowDownGlyph), typeof(Geometry), typeof(ScrollBar), new FrameworkPropertyMetadata(s_glyphDown));
public static readonly DependencyProperty ThumbBrushProperty =
DependencyProperty.Register(nameof(ThumbBrush), typeof(Brush), typeof(ScrollBar), new FrameworkPropertyMetadata(s_thumbBrush));
public static readonly DependencyProperty GlyphBrushProperty =
DependencyProperty.Register(nameof(GlyphBrush), typeof(Brush), typeof(ScrollBar), new FrameworkPropertyMetadata(s_glyphBrush));
public static readonly DependencyProperty HoverBackgroundProperty =
DependencyProperty.Register(nameof(HoverBackground), typeof(Brush), typeof(ScrollBar), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty HoverBorderBrushProperty =
DependencyProperty.Register(nameof(HoverBorderBrush), typeof(Brush), typeof(ScrollBar), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty HoverThumbBrushProperty =
DependencyProperty.Register(nameof(HoverThumbBrush), typeof(Brush), typeof(ScrollBar), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty HoverGlyphBrushProperty =
DependencyProperty.Register(nameof(HoverGlyphBrush), typeof(Brush), typeof(ScrollBar), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty PressedBackgroundProperty =
DependencyProperty.Register(nameof(PressedBackground), typeof(Brush), typeof(ScrollBar), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty PressedBorderBrushProperty =
DependencyProperty.Register(nameof(PressedBorderBrush), typeof(Brush), typeof(ScrollBar), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty PressedThumbBrushProperty =
DependencyProperty.Register(nameof(PressedThumbBrush), typeof(Brush), typeof(ScrollBar), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty PressedGlyphBrushProperty =
DependencyProperty.Register(nameof(PressedGlyphBrush), typeof(Brush), typeof(ScrollBar), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty DisabledBackgroundProperty =
DependencyProperty.Register(nameof(DisabledBackground), typeof(Brush), typeof(ScrollBar), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty DisabledBorderBrushProperty =
DependencyProperty.Register(nameof(DisabledBorderBrush), typeof(Brush), typeof(ScrollBar), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty DisabledThumbBrushProperty =
DependencyProperty.Register(nameof(DisabledThumbBrush), typeof(Brush), typeof(ScrollBar), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty DisabledGlyphBrushProperty =
DependencyProperty.Register(nameof(DisabledGlyphBrush), typeof(Brush), typeof(ScrollBar), new FrameworkPropertyMetadata(s_disabledGlyphBrush));
}
}

514
EleCho.WpfSuite/Controls/ScrollBarResources.xaml

@ -1,514 +0,0 @@ @@ -1,514 +0,0 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ws="https://schemas.elecho.dev/wpfsuite">
<Style x:Key="FocusVisual">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Margin="2" StrokeDashArray="1 2" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" SnapsToDevicePixels="true" StrokeThickness="1"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="RepeatButtonTransparent" TargetType="{x:Type ws:RepeatButton}">
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Focusable" Value="false"/>
<Setter Property="IsTabStop" Value="false"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ws:RepeatButton}">
<Rectangle Fill="{TemplateBinding Background}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ScrollBarButton" TargetType="{x:Type ws:RepeatButton}">
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="1"/>
<Setter Property="Focusable" Value="false"/>
<Setter Property="IsTabStop" Value="false"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ws:RepeatButton}">
<ws:Border x:Name="border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
SnapsToDevicePixels="true">
<ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</ws:Border>
<ControlTemplate.Triggers>
<Trigger Property="ClipToBounds" Value="True">
<Setter TargetName="contentPresenter"
Property="Clip"
Value="{Binding ElementName=border,Path=ContentClip}"/>
</Trigger>
<Trigger Property="Button.IsDefaulted" Value="true">
<Setter Property="BorderBrush" TargetName="border">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="HighlightBrush"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="BorderBrush"/>
</MultiBinding>
</Setter.Value>
</Setter>
</Trigger>
<!--Hover styles bellow-->
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="Background">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="HoverBackground"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Background"/>
</MultiBinding>
</Setter.Value>
</Setter>
<Setter TargetName="border" Property="BorderBrush">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="HoverBorderBrush"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="BorderBrush"/>
</MultiBinding>
</Setter.Value>
</Setter>
<Setter TargetName="contentPresenter" Property="TextElement.Foreground">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="HoverForeground"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Foreground"/>
</MultiBinding>
</Setter.Value>
</Setter>
</Trigger>
<!--Pressed styles bellow-->
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="border" Property="Background">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="PressedBackground"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Background"/>
</MultiBinding>
</Setter.Value>
</Setter>
<Setter TargetName="border" Property="BorderBrush">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="PressedBorderBrush"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="BorderBrush"/>
</MultiBinding>
</Setter.Value>
</Setter>
<Setter TargetName="contentPresenter" Property="TextElement.Foreground">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="PressedForeground"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Foreground"/>
</MultiBinding>
</Setter.Value>
</Setter>
</Trigger>
<!--Disabled styles bellow-->
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="contentPresenter" Property="Opacity" Value=".56"/>
<Setter TargetName="border" Property="Background">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="DisabledBackground"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Background"/>
</MultiBinding>
</Setter.Value>
</Setter>
<Setter TargetName="border" Property="BorderBrush">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="DisabledBorderBrush"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="BorderBrush"/>
</MultiBinding>
</Setter.Value>
</Setter>
<Setter TargetName="contentPresenter" Property="TextElement.Foreground">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="DisabledForeground"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Foreground"/>
</MultiBinding>
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ScrollBarThumbVertical" TargetType="{x:Type ws:Thumb}">
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="IsTabStop" Value="false"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ws:Thumb}">
<Border x:Name="rectangle"
Background="{TemplateBinding Background}"
CornerRadius="{TemplateBinding CornerRadius}"
Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}"
SnapsToDevicePixels="True"/>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" TargetName="rectangle" Value="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},Path=HoverBackground}"/>
</Trigger>
<Trigger Property="IsDragging" Value="true">
<Setter Property="Background" TargetName="rectangle" Value="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},Path=PressedBackground}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ScrollBarThumbHorizontal" TargetType="{x:Type ws:Thumb}">
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="IsTabStop" Value="false"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ws:Thumb}">
<Rectangle x:Name="rectangle" Fill="{TemplateBinding Background}" Height="{TemplateBinding Height}" SnapsToDevicePixels="True" Width="{TemplateBinding Width}"/>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Fill" TargetName="rectangle" Value="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},Path=HoverBackground}"/>
</Trigger>
<Trigger Property="IsDragging" Value="true">
<Setter Property="Fill" TargetName="rectangle" Value="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},Path=PressedBackground}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type ws:ScrollBar}">
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
<Setter Property="Stylus.IsFlicksEnabled" Value="false"/>
<Setter Property="Background" Value="#F0F0F0"/>
<Setter Property="BorderBrush" Value="#F0F0F0"/>
<Setter Property="GlyphBrush" Value="#606060"/>
<Setter Property="ThumbBrush" Value="#CDCDCD"/>
<Setter Property="HoverBackground" Value="#DADADA"/>
<Setter Property="HoverBorderBrush" Value="#DADADA"/>
<Setter Property="HoverGlyphBrush" Value="#000000"/>
<Setter Property="HoverThumbBrush" Value="#A6A6A6"/>
<Setter Property="PressedBackground" Value="#606060"/>
<Setter Property="PressedBorderBrush" Value="#606060"/>
<Setter Property="PressedThumbBrush" Value="#606060"/>
<Setter Property="PressedGlyphBrush" Value="#FFFFFF"/>
<Setter Property="DisabledBackground" Value="#F0F0F0"/>
<Setter Property="DisabledBorderBrush" Value="#F0F0F0"/>
<Setter Property="DisabledGlyphBrush" Value="#BFBFBF"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Setter Property="Width" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>
<Setter Property="MinWidth" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ws:ScrollBar}">
<ws:Border x:Name="PART_Border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<Grid x:Name="Bg" SnapsToDevicePixels="true">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="0.00001*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<ws:RepeatButton x:Name="PART_LineUpButton"
Command="{x:Static ScrollBar.LineUpCommand}"
IsEnabled="{TemplateBinding IsMouseOver}"
Style="{StaticResource ScrollBarButton}"
Background="{TemplateBinding Background}"
HoverBackground="{TemplateBinding HoverBackground}"
PressedBackground="{TemplateBinding PressedBackground}"
DisabledBackground="{TemplateBinding DisabledBackground}"
BorderBrush="{TemplateBinding BorderBrush}"
HoverBorderBrush="{TemplateBinding HoverBorderBrush}"
PressedBorderBrush="{TemplateBinding PressedBorderBrush}"
DisabledBorderBrush="{TemplateBinding DisabledBorderBrush}"
CornerRadius="{TemplateBinding ButtonCornerRadius}">
<Path x:Name="ArrowTop"
Data="{TemplateBinding ArrowUpGlyph}"
Fill="{TemplateBinding GlyphBrush}"
Margin="{TemplateBinding GlyphMargin}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Stretch="Uniform"/>
</ws:RepeatButton>
<Track x:Name="PART_Track" IsDirectionReversed="true" IsEnabled="{TemplateBinding IsMouseOver}" Grid.Row="1">
<Track.DecreaseRepeatButton>
<ws:RepeatButton Command="{x:Static ScrollBar.PageUpCommand}" Style="{StaticResource RepeatButtonTransparent}"/>
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<ws:RepeatButton Command="{x:Static ScrollBar.PageDownCommand}" Style="{StaticResource RepeatButtonTransparent}"/>
</Track.IncreaseRepeatButton>
<Track.Thumb>
<ws:Thumb Style="{StaticResource ScrollBarThumbVertical}"
Background="{TemplateBinding ThumbBrush}"
HoverBackground="{TemplateBinding HoverThumbBrush}"
PressedBackground="{TemplateBinding PressedThumbBrush}"
DisabledBackground="{TemplateBinding DisabledThumbBrush}"
CornerRadius="{TemplateBinding ThumbCornerRadius}"/>
</Track.Thumb>
</Track>
<ws:RepeatButton x:Name="PART_LineDownButton"
Command="{x:Static ScrollBar.LineDownCommand}"
IsEnabled="{TemplateBinding IsMouseOver}"
Grid.Row="2"
Style="{StaticResource ScrollBarButton}"
Background="{TemplateBinding Background}"
HoverBackground="{TemplateBinding HoverBackground}"
PressedBackground="{TemplateBinding PressedBackground}"
DisabledBackground="{TemplateBinding DisabledBackground}"
BorderBrush="{TemplateBinding BorderBrush}"
HoverBorderBrush="{TemplateBinding HoverBorderBrush}"
PressedBorderBrush="{TemplateBinding PressedBorderBrush}"
DisabledBorderBrush="{TemplateBinding DisabledBorderBrush}"
CornerRadius="{TemplateBinding ButtonCornerRadius}">
<Path x:Name="ArrowBottom" Data="{TemplateBinding ArrowDownGlyph}"
Fill="{TemplateBinding GlyphBrush}"
Margin="{TemplateBinding GlyphMargin}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Stretch="Uniform"/>
</ws:RepeatButton>
</Grid>
</ws:Border>
<ControlTemplate.Triggers>
<Trigger Property="ClipToBounds" Value="True">
<Setter TargetName="Bg"
Property="Clip"
Value="{Binding ElementName=PART_Border,Path=ContentClip}"/>
</Trigger>
<DataTrigger Binding="{Binding ElementName=PART_LineDownButton,Path=IsMouseOver}" Value="True">
<Setter Property="Fill" TargetName="ArrowBottom">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="HoverGlyphBrush"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="GlyphBrush"/>
</MultiBinding>
</Setter.Value>
</Setter>
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=PART_LineDownButton,Path=IsPressed}" Value="True">
<Setter Property="Fill" TargetName="ArrowBottom">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="PressedGlyphBrush"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="GlyphBrush"/>
</MultiBinding>
</Setter.Value>
</Setter>
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=PART_LineUpButton,Path=IsMouseOver}" Value="True">
<Setter Property="Fill" TargetName="ArrowTop">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="HoverGlyphBrush"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="GlyphBrush"/>
</MultiBinding>
</Setter.Value>
</Setter>
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=PART_LineUpButton,Path=IsPressed}" Value="True">
<Setter Property="Fill" TargetName="ArrowTop">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="PressedGlyphBrush"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="GlyphBrush"/>
</MultiBinding>
</Setter.Value>
</Setter>
</DataTrigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Fill" TargetName="ArrowTop">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="DisabledGlyphBrush"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="GlyphBrush"/>
</MultiBinding>
</Setter.Value>
</Setter>
<Setter Property="Fill" TargetName="ArrowBottom">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="DisabledGlyphBrush"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="GlyphBrush"/>
</MultiBinding>
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="Orientation" Value="Horizontal">
<Setter Property="Width" Value="Auto"/>
<Setter Property="MinWidth" Value="0"/>
<Setter Property="Height" Value="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}"/>
<Setter Property="MinHeight" Value="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ws:ScrollBar}">
<ws:Border x:Name="PART_Border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<Grid x:Name="Bg" SnapsToDevicePixels="true">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="0.00001*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<ws:RepeatButton x:Name="PART_LineLeftButton"
Command="{x:Static ScrollBar.LineLeftCommand}"
IsEnabled="{TemplateBinding IsMouseOver}"
Style="{StaticResource ScrollBarButton}"
Background="{TemplateBinding Background}"
HoverBackground="{TemplateBinding HoverBackground}"
PressedBackground="{TemplateBinding PressedBackground}"
DisabledBackground="{TemplateBinding DisabledBackground}"
BorderBrush="{TemplateBinding BorderBrush}"
HoverBorderBrush="{TemplateBinding HoverBorderBrush}"
PressedBorderBrush="{TemplateBinding PressedBorderBrush}"
DisabledBorderBrush="{TemplateBinding DisabledBorderBrush}"
CornerRadius="{TemplateBinding ButtonCornerRadius}">
<Path x:Name="ArrowLeft"
Data="{TemplateBinding ArrowLeftGlyph}"
Fill="{TemplateBinding GlyphBrush}"
Margin="{TemplateBinding GlyphMargin}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Stretch="Uniform"/>
</ws:RepeatButton>
<Track x:Name="PART_Track" Grid.Column="1" IsEnabled="{TemplateBinding IsMouseOver}">
<Track.DecreaseRepeatButton>
<ws:RepeatButton Command="{x:Static ScrollBar.PageLeftCommand}" Style="{StaticResource RepeatButtonTransparent}"/>
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<ws:RepeatButton Command="{x:Static ScrollBar.PageRightCommand}" Style="{StaticResource RepeatButtonTransparent}"/>
</Track.IncreaseRepeatButton>
<Track.Thumb>
<ws:Thumb Style="{StaticResource ScrollBarThumbHorizontal}"
Background="{TemplateBinding ThumbBrush}"
HoverBackground="{TemplateBinding HoverThumbBrush}"
PressedBackground="{TemplateBinding PressedThumbBrush}"
DisabledBackground="{TemplateBinding DisabledThumbBrush}"
CornerRadius="{TemplateBinding ThumbCornerRadius}"/>
</Track.Thumb>
</Track>
<ws:RepeatButton x:Name="PART_LineRightButton"
Command="{x:Static ScrollBar.LineRightCommand}"
Grid.Column="2"
IsEnabled="{TemplateBinding IsMouseOver}"
Style="{StaticResource ScrollBarButton}"
Background="{TemplateBinding Background}"
HoverBackground="{TemplateBinding HoverBackground}"
PressedBackground="{TemplateBinding PressedBackground}"
DisabledBackground="{TemplateBinding DisabledBackground}"
BorderBrush="{TemplateBinding BorderBrush}"
HoverBorderBrush="{TemplateBinding HoverBorderBrush}"
PressedBorderBrush="{TemplateBinding PressedBorderBrush}"
DisabledBorderBrush="{TemplateBinding DisabledBorderBrush}"
CornerRadius="{TemplateBinding ButtonCornerRadius}">
<Path x:Name="ArrowRight"
Data="{TemplateBinding ArrowRightGlyph}"
Fill="{TemplateBinding GlyphBrush}"
Margin="{TemplateBinding GlyphMargin}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Stretch="Uniform"/>
</ws:RepeatButton>
</Grid>
</ws:Border>
<ControlTemplate.Triggers>
<Trigger Property="ClipToBounds" Value="True">
<Setter TargetName="Bg"
Property="Clip"
Value="{Binding ElementName=PART_Border,Path=ContentClip}"/>
</Trigger>
<DataTrigger Binding="{Binding ElementName=PART_LineRightButton,Path=IsMouseOver}" Value="True">
<Setter Property="Fill" TargetName="ArrowRight">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="HoverGlyphBrush"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="GlyphBrush"/>
</MultiBinding>
</Setter.Value>
</Setter>
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=PART_LineRightButton,Path=IsPressed}" Value="True">
<Setter Property="Fill" TargetName="ArrowRight">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="PressedGlyphBrush"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="GlyphBrush"/>
</MultiBinding>
</Setter.Value>
</Setter>
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=PART_LineLeftButton,Path=IsMouseOver}" Value="True">
<Setter Property="Fill" TargetName="ArrowLeft">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="HoverGlyphBrush"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="GlyphBrush"/>
</MultiBinding>
</Setter.Value>
</Setter>
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=PART_LineLeftButton,Path=IsPressed}" Value="True">
<Setter Property="Fill" TargetName="ArrowLeft">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="PressedGlyphBrush"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="GlyphBrush"/>
</MultiBinding>
</Setter.Value>
</Setter>
</DataTrigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Fill" TargetName="ArrowLeft">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="DisabledGlyphBrush"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="GlyphBrush"/>
</MultiBinding>
</Setter.Value>
</Setter>
<Setter Property="Fill" TargetName="ArrowRight">
<Setter.Value>
<MultiBinding Converter="{x:Static ws:FallbackConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="DisabledGlyphBrush"/>
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="GlyphBrush"/>
</MultiBinding>
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>

34
EleCho.WpfSuite/Controls/ScrollViewerResources.xaml

@ -1,34 +0,0 @@ @@ -1,34 +0,0 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ws="https://schemas.elecho.dev/wpfsuite">
<Style TargetType="{x:Type ws:ScrollViewer}"
BasedOn="{StaticResource {x:Type ScrollViewer}}">
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ws:ScrollViewer}">
<Grid x:Name="Grid" Background="{TemplateBinding Background}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Rectangle x:Name="Corner" Grid.Column="1" Fill="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" Grid.Row="1"/>
<ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanHorizontallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" CanVerticallyScroll="False" Grid.Column="0" Content="{TemplateBinding Content}" CanContentScroll="{TemplateBinding CanContentScroll}" Margin="{TemplateBinding Padding}" Grid.Row="0"/>
<ws:ScrollBar x:Name="PART_VerticalScrollBar" AutomationProperties.AutomationId="VerticalScrollBar" Cursor="Arrow" Grid.Column="1" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Grid.Row="0" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource Mode=TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"/>
<ws:ScrollBar x:Name="PART_HorizontalScrollBar" AutomationProperties.AutomationId="HorizontalScrollBar" Cursor="Arrow" Grid.Column="0" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Orientation="Horizontal" Grid.Row="1" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource Mode=TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>

55
EleCho.WpfSuite/Controls/Thumb.cs

@ -1,55 +0,0 @@ @@ -1,55 +0,0 @@
using System.Windows;
using System.Windows.Media;
namespace EleCho.WpfSuite
{
public class Thumb : System.Windows.Controls.Primitives.Thumb
{
static Thumb()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(Thumb), new FrameworkPropertyMetadata(typeof(Thumb)));
}
/// <summary>
/// The CornerRadius property allows users to control the roundness of the corners independently by
/// setting a radius value for each corner. Radius values that are too large are scaled so that they
/// smoothly blend from corner to corner.
/// </summary>
public CornerRadius CornerRadius
{
get { return (CornerRadius)GetValue(CornerRadiusProperty); }
set { SetValue(CornerRadiusProperty, value); }
}
public Brush HoverBackground
{
get { return (Brush)GetValue(HoverBackgroundProperty); }
set { SetValue(HoverBackgroundProperty, value); }
}
public Brush PressedBackground
{
get { return (Brush)GetValue(PressedBackgroundProperty); }
set { SetValue(PressedBackgroundProperty, value); }
}
public Brush DisabledBackground
{
get { return (Brush)GetValue(DisabledBackgroundProperty); }
set { SetValue(DisabledBackgroundProperty, value); }
}
public static readonly DependencyProperty CornerRadiusProperty =
Border.CornerRadiusProperty.AddOwner(typeof(Thumb));
public static readonly DependencyProperty HoverBackgroundProperty =
DependencyProperty.Register(nameof(HoverBackground), typeof(Brush), typeof(Thumb), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty PressedBackgroundProperty =
DependencyProperty.Register(nameof(PressedBackground), typeof(Brush), typeof(Thumb), new FrameworkPropertyMetadata(null));
public static readonly DependencyProperty DisabledBackgroundProperty =
DependencyProperty.Register(nameof(DisabledBackground), typeof(Brush), typeof(Thumb), new FrameworkPropertyMetadata(null));
}
}

34
EleCho.WpfSuite/Controls/ThumbResources.xaml

@ -1,34 +0,0 @@ @@ -1,34 +0,0 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ws="https://schemas.elecho.dev/wpfsuite">
<Style TargetType="{x:Type ws:Thumb}">
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ws:Thumb}">
<ws:Border x:Name="PART_Border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<Grid x:Name="PART_Content">
<Border Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" BorderBrush="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" BorderThickness="0,0,1,1"/>
<Border Background="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}" BorderBrush="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}" BorderThickness="0,0,1,1" Margin="1"/>
<Border Background="{TemplateBinding Background}" Margin="2"/>
</Grid>
</ws:Border>
<ControlTemplate.Triggers>
<Trigger Property="ClipToBounds" Value="True">
<Setter TargetName="PART_Content"
Property="Clip"
Value="{Binding ElementName=PART_Border,Path=ContentClip}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

16
EleCho.WpfSuite/EleCho.WpfSuite.csproj

@ -33,43 +33,27 @@ @@ -33,43 +33,27 @@
<Page Remove="Controls\FrameResources.xaml" />
<Page Remove="Controls\GroupBoxResources.xaml" />
<Page Remove="Controls\ImageResources.xaml" />
<Page Remove="Controls\ListBoxItemResources.xaml" />
<Page Remove="Controls\ListBoxResources.xaml" />
<Page Remove="Controls\ListViewItemResources.xaml" />
<Page Remove="Controls\ListViewResources.xaml" />
<Page Remove="Controls\MenuItemResources.xaml" />
<Page Remove="Controls\MenuResources.xaml" />
<Page Remove="Controls\PasswordBoxResources.xaml" />
<Page Remove="Controls\PopupResources.xaml" />
<Page Remove="Controls\ProgressBarResources.xaml" />
<Page Remove="Controls\RepeatButtonResources.xaml" />
<Page Remove="Controls\ScrollBarResources.xaml" />
<Page Remove="Controls\ScrollViewerResources.xaml" />
<Page Remove="Controls\SlicedImageResources.xaml" />
<Page Remove="Controls\TabControlResources.xaml" />
<Page Remove="Controls\TabItemResources.xaml" />
<Page Remove="Controls\TextBoxResources.xaml" />
<Page Remove="Controls\ThumbResources.xaml" />
<Page Remove="Controls\ToggleButtonResources.xaml" />
<Page Remove="Controls\TooltipResources.xaml" />
<Page Remove="Controls\TransitioningContentControlResources.xaml" />
</ItemGroup>
<ItemGroup>
<Resource Include="Controls\ListBoxItemResources.xaml">
<Generator>MSBuild:Compile</Generator>
</Resource>
<Resource Include="Controls\ListBoxResources.xaml">
<Generator>MSBuild:Compile</Generator>
</Resource>
<Resource Include="Controls\ListViewItemResources.xaml" />
<Resource Include="Controls\ListViewResources.xaml" />
<Resource Include="Controls\RepeatButtonResources.xaml" />
<Resource Include="Controls\ScrollBarResources.xaml" />
<Resource Include="Controls\ScrollViewerResources.xaml">
<Generator>MSBuild:Compile</Generator>
</Resource>
<Resource Include="Controls\ThumbResources.xaml" />
</ItemGroup>
<ItemGroup>

11
EleCho.WpfSuite/Themes/Generic.xaml

@ -1,14 +1,7 @@ @@ -1,14 +1,7 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/EleCho.WpfSuite;component/Controls/ScrollViewerResources.xaml"/>
<ResourceDictionary Source="pack://application:,,,/EleCho.WpfSuite;component/Controls/RepeatButtonResources.xaml"/>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/EleCho.WpfSuite;component/Controls/ListBoxResources.xaml"/>
<ResourceDictionary Source="pack://application:,,,/EleCho.WpfSuite;component/Controls/ListBoxItemResources.xaml"/>
<ResourceDictionary Source="pack://application:,,,/EleCho.WpfSuite;component/Controls/ListViewResources.xaml"/>
<ResourceDictionary Source="pack://application:,,,/EleCho.WpfSuite;component/Controls/ListViewItemResources.xaml"/>
<ResourceDictionary Source="pack://application:,,,/EleCho.WpfSuite;component/Controls/ScrollViewerResources.xaml"/>
<ResourceDictionary Source="pack://application:,,,/EleCho.WpfSuite;component/Controls/ScrollBarResources.xaml"/>
<ResourceDictionary Source="pack://application:,,,/EleCho.WpfSuite;component/Controls/ThumbResources.xaml"/>
<ResourceDictionary Source="pack://application:,,,/EleCho.WpfSuite;component/Controls/ListViewResources.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

26
ILSpy/App.xaml

@ -5,7 +5,6 @@ @@ -5,7 +5,6 @@
xmlns:toms="urn:TomsToolbox"
xmlns:ilSpy="clr-namespace:ICSharpCode.ILSpy"
xmlns:themes="clr-namespace:ICSharpCode.ILSpy.Themes"
xmlns:ws="https://schemas.elecho.dev/wpfsuite"
StartupUri="MainWindow.xaml">
<Application.Resources>
<Style x:Key="DialogWindow" TargetType="{x:Type Window}">
@ -21,27 +20,10 @@ @@ -21,27 +20,10 @@
</Setter>
</Style>
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Static styles:ResourceKeys.ButtonStyle}}">
<Setter Property="MinWidth" Value="73" />
<Setter Property="Padding" Value="9,1,9,1" />
</Style>
<Style TargetType="{x:Type ws:ScrollBar}"
BasedOn="{StaticResource {x:Type ws:ScrollBar}}">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Margin" Value="-1"/>
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
<Setter Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
<Setter Property="GlyphBrush" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Setter Property="HoverBackground" Value="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"/>
<Setter Property="HoverBorderBrush" Value="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"/>
<Setter Property="HoverGlyphBrush" Value="{x:Null}"/>
<Setter Property="DisabledBackground" Value="{x:Null}"/>
<Setter Property="DisabledBorderBrush" Value="{x:Null}"/>
<Setter Property="DisabledGlyphBrush" Value="{x:Null}"/>
<Setter Property="ThumbBrush" Value="{DynamicResource {x:Static SystemColors.ControlLightBrushKey}}"/>
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Static styles:ResourceKeys.ButtonStyle}}">
<Setter Property="MinWidth" Value="73" />
<Setter Property="Padding" Value="9,1,9,1" />
</Style>
</Application.Resources>
</Application.Resources>
</Application>

2
SharpTreeView/SharpTreeViewItem.cs

@ -24,7 +24,7 @@ using System.Windows.Input; @@ -24,7 +24,7 @@ using System.Windows.Input;
namespace ICSharpCode.TreeView
{
public class SharpTreeViewItem : EleCho.WpfSuite.ListViewItem
public class SharpTreeViewItem : ListViewItem
{
static SharpTreeViewItem()
{

Loading…
Cancel
Save