mirror of https://github.com/icsharpcode/ILSpy.git
26 changed files with 161 additions and 596 deletions
@ -1,6 +0,0 @@
@@ -1,6 +0,0 @@
|
||||
using System.Runtime.CompilerServices; |
||||
using System.Windows.Markup; |
||||
|
||||
[assembly: System.Windows.ThemeInfo(System.Windows.ResourceDictionaryLocation.None, System.Windows.ResourceDictionaryLocation.SourceAssembly)] |
||||
[assembly: XmlnsDefinition("https://schemas.elecho.dev/wpfsuite", "EleCho.WpfSuite")] |
||||
//[assembly: XmlnsDefinition("https://schemas.elecho.dev/wpfsuite", "EleCho.WpfSuite.Markup")]
|
@ -1,69 +0,0 @@
@@ -1,69 +0,0 @@
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using System.Text; |
||||
using System.Threading.Tasks; |
||||
using System.Windows; |
||||
using System.Windows.Data; |
||||
using System.Windows.Documents; |
||||
using System.Windows.Input; |
||||
using System.Windows.Media; |
||||
using System.Windows.Media.Imaging; |
||||
using System.Windows.Navigation; |
||||
using System.Windows.Shapes; |
||||
|
||||
namespace EleCho.WpfSuite |
||||
{ |
||||
/// <inheritdoc/>
|
||||
public class ListBox : System.Windows.Controls.ListBox |
||||
{ |
||||
static ListBox() |
||||
{ |
||||
DefaultStyleKeyProperty.OverrideMetadata(typeof(ListBox), new FrameworkPropertyMetadata(typeof(ListBox))); |
||||
} |
||||
|
||||
/// <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); } |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Background when disabled
|
||||
/// </summary>
|
||||
public Brush DisabledBackground { |
||||
get { return (Brush)GetValue(DisabledBackgroundProperty); } |
||||
set { SetValue(DisabledBackgroundProperty, value); } |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// BorderBrush when pressed by mouse
|
||||
/// </summary>
|
||||
public Brush DisabledBorderBrush { |
||||
get { return (Brush)GetValue(DisabledBorderBrushProperty); } |
||||
set { SetValue(DisabledBorderBrushProperty, value); } |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// DependencyProperty of <see cref="CornerRadius"/> property
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty CornerRadiusProperty = |
||||
System.Windows.Controls.Border.CornerRadiusProperty.AddOwner(typeof(ListBox)); |
||||
|
||||
/// <summary>
|
||||
/// The DependencyProperty of <see cref="DisabledBackground"/> property
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty DisabledBackgroundProperty = |
||||
DependencyProperty.Register(nameof(DisabledBackground), typeof(Brush), typeof(ListBox), new FrameworkPropertyMetadata(null)); |
||||
|
||||
/// <summary>
|
||||
/// The DependencyProperty of <see cref="DisabledBorderBrush"/> property
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty DisabledBorderBrushProperty = |
||||
DependencyProperty.Register(nameof(DisabledBorderBrush), typeof(Brush), typeof(ListBox), new FrameworkPropertyMetadata(null)); |
||||
} |
||||
} |
@ -1,68 +0,0 @@
@@ -1,68 +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"> |
||||
|
||||
<SolidColorBrush x:Key="ListBox.Static.Background" Color="#FFFFFFFF"/> |
||||
<SolidColorBrush x:Key="ListBox.Static.Border" Color="#FFABADB3"/> |
||||
<SolidColorBrush x:Key="ListBox.Disabled.Background" Color="#FFFFFFFF"/> |
||||
<SolidColorBrush x:Key="ListBox.Disabled.Border" Color="#FFD9D9D9"/> |
||||
<Style TargetType="{x:Type ws:ListBox}"> |
||||
<Setter Property="Background" Value="{StaticResource ListBox.Static.Background}"/> |
||||
<Setter Property="BorderBrush" Value="{StaticResource ListBox.Static.Border}"/> |
||||
<Setter Property="DisabledBackground" Value="{StaticResource ListBox.Disabled.Background}"/> |
||||
<Setter Property="DisabledBorderBrush" Value="{StaticResource ListBox.Disabled.Border}"/> |
||||
<Setter Property="BorderThickness" Value="1"/> |
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/> |
||||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/> |
||||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/> |
||||
<Setter Property="ScrollViewer.CanContentScroll" Value="true"/> |
||||
<Setter Property="ScrollViewer.PanningMode" Value="Both"/> |
||||
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/> |
||||
<Setter Property="VerticalContentAlignment" Value="Center"/> |
||||
<Setter Property="Template"> |
||||
<Setter.Value> |
||||
<ControlTemplate TargetType="{x:Type ws:ListBox}"> |
||||
<Border x:Name="Part_BD" |
||||
Background="{TemplateBinding Background}" |
||||
BorderBrush="{TemplateBinding BorderBrush}" |
||||
BorderThickness="{TemplateBinding BorderThickness}" |
||||
CornerRadius="{TemplateBinding CornerRadius}" |
||||
Padding="1" |
||||
SnapsToDevicePixels="true"> |
||||
<ws:ScrollViewer x:Name="PART_Content" |
||||
Focusable="false" Padding="{TemplateBinding Padding}"> |
||||
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/> |
||||
</ws:ScrollViewer> |
||||
</Border> |
||||
<ControlTemplate.Triggers> |
||||
<Trigger Property="IsEnabled" Value="False"> |
||||
<Setter TargetName="Part_BD" 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="Part_BD" 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> |
||||
</Trigger> |
||||
<MultiTrigger> |
||||
<MultiTrigger.Conditions> |
||||
<Condition Property="IsGrouping" Value="true"/> |
||||
<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false"/> |
||||
</MultiTrigger.Conditions> |
||||
<Setter Property="ScrollViewer.CanContentScroll" Value="false"/> |
||||
</MultiTrigger> |
||||
</ControlTemplate.Triggers> |
||||
</ControlTemplate> |
||||
</Setter.Value> |
||||
</Setter> |
||||
</Style> |
||||
</ResourceDictionary> |
@ -1,60 +0,0 @@
@@ -1,60 +0,0 @@
|
||||
using System.Windows; |
||||
using System.Windows.Media; |
||||
|
||||
namespace EleCho.WpfSuite |
||||
{ |
||||
/// <inheritdoc/>
|
||||
public class ListView : System.Windows.Controls.ListView |
||||
{ |
||||
static ListView() |
||||
{ |
||||
DefaultStyleKeyProperty.OverrideMetadata(typeof(ListView), new FrameworkPropertyMetadata(typeof(ListView))); |
||||
} |
||||
|
||||
|
||||
/// <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); } |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Background when disabled
|
||||
/// </summary>
|
||||
public Brush DisabledBackground { |
||||
get { return (Brush)GetValue(DisabledBackgroundProperty); } |
||||
set { SetValue(DisabledBackgroundProperty, value); } |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// BorderBrush when pressed by mouse
|
||||
/// </summary>
|
||||
public Brush DisabledBorderBrush { |
||||
get { return (Brush)GetValue(DisabledBorderBrushProperty); } |
||||
set { SetValue(DisabledBorderBrushProperty, value); } |
||||
} |
||||
|
||||
|
||||
/// <summary>
|
||||
/// DependencyProperty of <see cref="CornerRadius"/> property
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty CornerRadiusProperty = |
||||
System.Windows.Controls.Border.CornerRadiusProperty.AddOwner(typeof(ListView)); |
||||
|
||||
/// <summary>
|
||||
/// The DependencyProperty of <see cref="DisabledBackground"/> property
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty DisabledBackgroundProperty = |
||||
DependencyProperty.Register(nameof(DisabledBackground), typeof(Brush), typeof(ListView), new FrameworkPropertyMetadata(null)); |
||||
|
||||
/// <summary>
|
||||
/// The DependencyProperty of <see cref="DisabledBorderBrush"/> property
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty DisabledBorderBrushProperty = |
||||
DependencyProperty.Register(nameof(DisabledBorderBrush), typeof(Brush), typeof(ListView), new FrameworkPropertyMetadata(null)); |
||||
} |
||||
} |
@ -1,68 +0,0 @@
@@ -1,68 +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"> |
||||
|
||||
<SolidColorBrush x:Key="ListBox.Static.Background" Color="#FFFFFFFF"/> |
||||
<SolidColorBrush x:Key="ListBox.Static.Border" Color="#FFABADB3"/> |
||||
<SolidColorBrush x:Key="ListBox.Disabled.Background" Color="#FFFFFFFF"/> |
||||
<SolidColorBrush x:Key="ListBox.Disabled.Border" Color="#FFD9D9D9"/> |
||||
<Style TargetType="{x:Type ws:ListView}"> |
||||
<Setter Property="Background" Value="{StaticResource ListBox.Static.Background}"/> |
||||
<Setter Property="BorderBrush" Value="{StaticResource ListBox.Static.Border}"/> |
||||
<Setter Property="DisabledBackground" Value="{StaticResource ListBox.Disabled.Background}"/> |
||||
<Setter Property="DisabledBorderBrush" Value="{StaticResource ListBox.Disabled.Border}"/> |
||||
<Setter Property="BorderThickness" Value="1"/> |
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/> |
||||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/> |
||||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/> |
||||
<Setter Property="ScrollViewer.CanContentScroll" Value="true"/> |
||||
<Setter Property="ScrollViewer.PanningMode" Value="Both"/> |
||||
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/> |
||||
<Setter Property="VerticalContentAlignment" Value="Center"/> |
||||
<Setter Property="Template"> |
||||
<Setter.Value> |
||||
<ControlTemplate TargetType="{x:Type ws:ListView}"> |
||||
<Border x:Name="Part_BD" |
||||
Background="{TemplateBinding Background}" |
||||
BorderBrush="{TemplateBinding BorderBrush}" |
||||
BorderThickness="{TemplateBinding BorderThickness}" |
||||
CornerRadius="{TemplateBinding CornerRadius}" |
||||
Padding="1" |
||||
SnapsToDevicePixels="true"> |
||||
<ws:ScrollViewer x:Name="PART_Content" |
||||
Focusable="false" Padding="{TemplateBinding Padding}"> |
||||
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/> |
||||
</ws:ScrollViewer> |
||||
</Border> |
||||
<ControlTemplate.Triggers> |
||||
<Trigger Property="IsEnabled" Value="False"> |
||||
<Setter TargetName="Part_BD" 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="Part_BD" 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> |
||||
</Trigger> |
||||
<MultiTrigger> |
||||
<MultiTrigger.Conditions> |
||||
<Condition Property="IsGrouping" Value="true"/> |
||||
<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false"/> |
||||
</MultiTrigger.Conditions> |
||||
<Setter Property="ScrollViewer.CanContentScroll" Value="false"/> |
||||
</MultiTrigger> |
||||
</ControlTemplate.Triggers> |
||||
</ControlTemplate> |
||||
</Setter.Value> |
||||
</Setter> |
||||
</Style> |
||||
</ResourceDictionary> |
@ -1,71 +0,0 @@
@@ -1,71 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
||||
<PropertyGroup> |
||||
<TargetFrameworks>net8.0-windows;net6.0-windows;net48;net47;net46;net45</TargetFrameworks> |
||||
<Nullable>enable</Nullable> |
||||
<LangVersion>latest</LangVersion> |
||||
<UseWPF>true</UseWPF> |
||||
<EnableWindowsTargeting>true</EnableWindowsTargeting> |
||||
<RootNamespace>EleCho.WpfSuite</RootNamespace> |
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> |
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile> |
||||
|
||||
<Version>0.6.0</Version> |
||||
|
||||
<Authors>EleCho</Authors> |
||||
<Copyright>Copyright © 2024 EleCho</Copyright> |
||||
<PackageProjectUrl>https://wpfsuite.elecho.dev</PackageProjectUrl> |
||||
<PackageIcon>logo.png</PackageIcon> |
||||
<PackageTags>WPF;MVVM;XAML;Toolkit;Control;Layout;Transition;Converter;Animation;MarkupExtension;BindingProxy</PackageTags> |
||||
<Description>WPF layout panels, controls, value converters, markup extensions, transitions and utilities</Description> |
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression> |
||||
<PackageReadmeFile>README.md</PackageReadmeFile> |
||||
<RepositoryUrl>https://github.com/OrgEleCho/EleCho.WpfSuite</RepositoryUrl> |
||||
</PropertyGroup> |
||||
|
||||
<ItemGroup> |
||||
<Page Remove="Controls\ButtonResources.xaml" /> |
||||
<Page Remove="Controls\CheckBoxResources.xaml" /> |
||||
<Page Remove="Controls\ComboBoxItemResources.xaml" /> |
||||
<Page Remove="Controls\ComboBoxResources.xaml" /> |
||||
<Page Remove="Controls\ConditionalControlResources.xaml" /> |
||||
<Page Remove="Controls\ContextMenuResources.xaml" /> |
||||
<Page Remove="Controls\FrameResources.xaml" /> |
||||
<Page Remove="Controls\GroupBoxResources.xaml" /> |
||||
<Page Remove="Controls\ImageResources.xaml" /> |
||||
<Page Remove="Controls\ListBoxResources.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\SlicedImageResources.xaml" /> |
||||
<Page Remove="Controls\TabControlResources.xaml" /> |
||||
<Page Remove="Controls\TabItemResources.xaml" /> |
||||
<Page Remove="Controls\TextBoxResources.xaml" /> |
||||
<Page Remove="Controls\ToggleButtonResources.xaml" /> |
||||
<Page Remove="Controls\TooltipResources.xaml" /> |
||||
<Page Remove="Controls\TransitioningContentControlResources.xaml" /> |
||||
</ItemGroup> |
||||
|
||||
<ItemGroup> |
||||
<Resource Include="Controls\ListBoxResources.xaml"> |
||||
<Generator>MSBuild:Compile</Generator> |
||||
</Resource> |
||||
<Resource Include="Controls\ListViewResources.xaml" /> |
||||
</ItemGroup> |
||||
|
||||
<ItemGroup> |
||||
<None Update="Controls\ListBoxItemResources.xaml"> |
||||
<Generator>MSBuild:Compile</Generator> |
||||
</None> |
||||
<None Update="Controls\ListBoxResources.xaml"> |
||||
<Generator>MSBuild:Compile</Generator> |
||||
</None> |
||||
<None Update="Controls\ScrollViewerResources.xaml"> |
||||
<Generator>MSBuild:Compile</Generator> |
||||
</None> |
||||
</ItemGroup> |
||||
|
||||
</Project> |
@ -1,75 +0,0 @@
@@ -1,75 +0,0 @@
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using System.Text; |
||||
using System.Threading.Tasks; |
||||
using System.Windows.Controls; |
||||
using System.Windows; |
||||
|
||||
namespace EleCho.WpfSuite |
||||
{ |
||||
internal static class MathHelper |
||||
{ |
||||
internal const double DBL_EPSILON = 2.2204460492503131e-016; |
||||
|
||||
public static bool AreClose(double value1, double value2) => |
||||
// ReSharper disable once CompareOfFloatsByEqualityOperator
|
||||
value1 == value2 || IsVerySmall(value1 - value2); |
||||
|
||||
public static double Lerp(double x, double y, double alpha) => x * (1.0 - alpha) + y * alpha; |
||||
|
||||
public static bool IsVerySmall(double value) => Math.Abs(value) < 1E-06; |
||||
|
||||
public static bool IsZero(double value) => Math.Abs(value) < 10.0 * DBL_EPSILON; |
||||
|
||||
public static bool IsFiniteDouble(double x) => !double.IsInfinity(x) && !double.IsNaN(x); |
||||
|
||||
public static double DoubleFromMantissaAndExponent(double x, int exp) => x * Math.Pow(2.0, exp); |
||||
|
||||
public static bool GreaterThan(double value1, double value2) => value1 > value2 && !AreClose(value1, value2); |
||||
|
||||
public static bool GreaterThanOrClose(double value1, double value2) |
||||
{ |
||||
if (value1 <= value2) |
||||
{ |
||||
return AreClose(value1, value2); |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
public static double Hypotenuse(double x, double y) => Math.Sqrt(x * x + y * y); |
||||
|
||||
public static bool LessThan(double value1, double value2) => value1 < value2 && !AreClose(value1, value2); |
||||
|
||||
public static bool LessThanOrClose(double value1, double value2) |
||||
{ |
||||
if (value1 >= value2) |
||||
{ |
||||
return AreClose(value1, value2); |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
public static double EnsureRange(double value, double? min, double? max) |
||||
{ |
||||
if (min.HasValue && value < min.Value) |
||||
{ |
||||
return min.Value; |
||||
} |
||||
if (max.HasValue && value > max.Value) |
||||
{ |
||||
return max.Value; |
||||
} |
||||
return value; |
||||
} |
||||
|
||||
public static double SafeDivide(double lhs, double rhs, double fallback) |
||||
{ |
||||
if (!IsVerySmall(rhs)) |
||||
{ |
||||
return lhs / rhs; |
||||
} |
||||
return fallback; |
||||
} |
||||
} |
||||
} |
@ -1,7 +0,0 @@
@@ -1,7 +0,0 @@
|
||||
<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/ListBoxResources.xaml"/> |
||||
<ResourceDictionary Source="pack://application:,,,/EleCho.WpfSuite;component/Controls/ListViewResources.xaml"/> |
||||
</ResourceDictionary.MergedDictionaries> |
||||
</ResourceDictionary> |
@ -1,26 +0,0 @@
@@ -1,26 +0,0 @@
|
||||
using System; |
||||
using System.Globalization; |
||||
using System.Windows; |
||||
|
||||
namespace EleCho.WpfSuite |
||||
{ |
||||
/// <summary>
|
||||
/// Fallback between multiple values, return the first non-null value
|
||||
/// </summary>
|
||||
public class FallbackConverter : SingletonMultiValueConverterBase<FallbackConverter> |
||||
{ |
||||
/// <inheritdoc/>
|
||||
public override object? Convert(object?[] values, Type targetType, object? parameter, CultureInfo culture) |
||||
{ |
||||
foreach (var value in values) |
||||
{ |
||||
if (value is not null && |
||||
value != DependencyProperty.UnsetValue) |
||||
return value; |
||||
} |
||||
|
||||
return null; |
||||
} |
||||
} |
||||
} |
||||
|
@ -1,22 +0,0 @@
@@ -1,22 +0,0 @@
|
||||
using System; |
||||
using System.Globalization; |
||||
using System.Windows.Data; |
||||
|
||||
namespace EleCho.WpfSuite |
||||
{ |
||||
/// <summary>
|
||||
/// Base class of multi value converter
|
||||
/// </summary>
|
||||
/// <typeparam name="TSelf"></typeparam>
|
||||
public abstract class MultiValueConverterBase<TSelf> : IMultiValueConverter |
||||
{ |
||||
/// <inheritdoc/>
|
||||
public abstract object? Convert(object?[] values, Type targetType, object? parameter, CultureInfo culture); |
||||
|
||||
/// <inheritdoc/>
|
||||
public virtual object?[] ConvertBack(object? value, Type[] targetTypes, object? parameter, CultureInfo culture) |
||||
{ |
||||
throw new NotSupportedException(); |
||||
} |
||||
} |
||||
} |
@ -1,17 +0,0 @@
@@ -1,17 +0,0 @@
|
||||
namespace EleCho.WpfSuite |
||||
{ |
||||
/// <summary>
|
||||
/// Base class of singleton multi value converter
|
||||
/// </summary>
|
||||
/// <typeparam name="TSelf"></typeparam>
|
||||
public abstract class SingletonMultiValueConverterBase<TSelf> : MultiValueConverterBase<TSelf> |
||||
where TSelf : SingletonMultiValueConverterBase<TSelf>, new() |
||||
{ |
||||
private static TSelf? _instance = null; |
||||
|
||||
/// <summary>
|
||||
/// Get an instance of <typeparamref name="TSelf"/>
|
||||
/// </summary>
|
||||
public static TSelf Instance => _instance ?? new(); |
||||
} |
||||
} |
@ -0,0 +1,14 @@
@@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
||||
<PropertyGroup> |
||||
<TargetFramework>net8.0-windows7</TargetFramework> |
||||
<ImplicitUsings>enable</ImplicitUsings> |
||||
<Nullable>enable</Nullable> |
||||
<UseWPF>true</UseWPF> |
||||
</PropertyGroup> |
||||
|
||||
<ItemGroup> |
||||
<PackageReference Include="TomsToolbox.Wpf" /> |
||||
</ItemGroup> |
||||
|
||||
</Project> |
Loading…
Reference in new issue