mirror of
https://github.com/holgerb83/ModernWpfPlayground.git
synced 2025-04-19 06:53:50 +02:00
file-scoped namespaces and update of modernwpfui
This commit is contained in:
parent
02e3af3dcb
commit
644e2628e3
@ -14,9 +14,9 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="FastMember" Version="1.5.0" />
|
||||
<PackageReference Include="Hardcodet.NotifyIcon.Wpf" Version="1.1.0" />
|
||||
<PackageReference Include="ModernWpfUis" Version="1.2.0" />
|
||||
<PackageReference Include="MvvmGen" Version="1.1.2" />
|
||||
<PackageReference Include="YamlDotNet" Version="11.2.1" />
|
||||
<PackageReference Include="ModernWpfUI" Version="0.9.7-preview.2" />
|
||||
<PackageReference Include="MvvmGen" Version="1.1.5" />
|
||||
<PackageReference Include="YamlDotNet" Version="12.0.2" />
|
||||
<PackageReference Include="MahApps.Metro.IconPacks.FontAwesome" Version="4.11.0" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -1,19 +1,19 @@
|
||||
using System;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace ModernWpfPlayground.Types
|
||||
namespace ModernWpfPlayground.Types;
|
||||
|
||||
public enum AccentColors
|
||||
{
|
||||
public enum AccentColors
|
||||
{
|
||||
Green,
|
||||
Yellow,
|
||||
Blue,
|
||||
Purple,
|
||||
Red
|
||||
}
|
||||
}
|
||||
|
||||
public static class AccentColorExtension
|
||||
{
|
||||
public static class AccentColorExtension
|
||||
{
|
||||
public static Color ToWindowsColor(this AccentColors accentColor)
|
||||
{
|
||||
return accentColor switch
|
||||
@ -26,5 +26,4 @@ namespace ModernWpfPlayground.Types
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(accentColor), accentColor, null)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -6,13 +6,13 @@ using System.Linq;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Markup;
|
||||
|
||||
namespace Controls
|
||||
namespace Controls;
|
||||
|
||||
/// <summary>
|
||||
/// Converts enums to a List with KeyValuePairs.
|
||||
/// </summary>
|
||||
public class EnumToItemSourceConverter : MarkupExtension, IValueConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts enums to a List with KeyValuePairs.
|
||||
/// </summary>
|
||||
public class EnumToItemSourceConverter : MarkupExtension, IValueConverter
|
||||
{
|
||||
private static EnumToItemSourceConverter? _converter;
|
||||
|
||||
object IValueConverter.Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
@ -45,5 +45,4 @@ namespace Controls
|
||||
}
|
||||
|
||||
public override object ProvideValue(IServiceProvider serviceProvider) => _converter ??= new EnumToItemSourceConverter();
|
||||
}
|
||||
}
|
@ -2,14 +2,14 @@
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Markup;
|
||||
|
||||
namespace Controls
|
||||
namespace Controls;
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for <see cref="MagicSymbolControl"/>
|
||||
/// </summary>
|
||||
[ContentProperty(nameof(Symbol))]
|
||||
public class MagicSymbolControl : ContentControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for <see cref="MagicSymbolControl"/>
|
||||
/// </summary>
|
||||
[ContentProperty(nameof(Symbol))]
|
||||
public class MagicSymbolControl : ContentControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Dependency property for <see cref="Symbol"/> property
|
||||
/// </summary>
|
||||
@ -39,5 +39,4 @@ namespace Controls
|
||||
{
|
||||
Focusable = false;
|
||||
}
|
||||
}
|
||||
}
|
@ -8,14 +8,14 @@ using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Controls
|
||||
namespace Controls;
|
||||
|
||||
/// <summary>
|
||||
/// Magically converts a text to
|
||||
/// </summary>
|
||||
[ValueConversion(typeof(string), typeof(FrameworkElement))]
|
||||
public class MagicSymbolConverter : IValueConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// Magically converts a text to
|
||||
/// </summary>
|
||||
[ValueConversion(typeof(string), typeof(FrameworkElement))]
|
||||
public class MagicSymbolConverter : IValueConverter
|
||||
{
|
||||
private const string NoParseKeyword = "noParse:";
|
||||
private const string PathKeyword = "path:";
|
||||
private const string DynResKeyword = "dynRes:";
|
||||
@ -148,5 +148,4 @@ namespace Controls
|
||||
/// <inheritdoc />
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
=> Binding.DoNothing;
|
||||
}
|
||||
}
|
@ -2,13 +2,13 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Controls
|
||||
namespace Controls;
|
||||
|
||||
/// <summary>
|
||||
/// Selects the right template on base of value-type.
|
||||
/// </summary>
|
||||
public class PropertyDataTemplateSelector : DataTemplateSelector
|
||||
{
|
||||
/// <summary>
|
||||
/// Selects the right template on base of value-type.
|
||||
/// </summary>
|
||||
public class PropertyDataTemplateSelector : DataTemplateSelector
|
||||
{
|
||||
/// <summary>
|
||||
/// Default data template. (currently Textbox)
|
||||
/// </summary>
|
||||
@ -35,5 +35,4 @@ namespace Controls
|
||||
_ => DefaultDataTemplate
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -3,15 +3,15 @@ using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Markup;
|
||||
|
||||
namespace Controls
|
||||
namespace Controls;
|
||||
|
||||
/// <inheritdoc cref="ContentControl" />
|
||||
/// <summary>
|
||||
/// Interaction logic for PropertyPresenter.xaml
|
||||
/// </summary>
|
||||
[ContentProperty(nameof(Value))]
|
||||
public sealed partial class PropertyPresenter
|
||||
{
|
||||
/// <inheritdoc cref="ContentControl" />
|
||||
/// <summary>
|
||||
/// Interaction logic for PropertyPresenter.xaml
|
||||
/// </summary>
|
||||
[ContentProperty(nameof(Value))]
|
||||
public sealed partial class PropertyPresenter
|
||||
{
|
||||
/// <summary>
|
||||
/// Button alignment property.
|
||||
/// </summary>
|
||||
@ -177,5 +177,4 @@ namespace Controls
|
||||
{
|
||||
return $"{base.ToString()} {Value}";
|
||||
}
|
||||
}
|
||||
}
|
@ -2,39 +2,39 @@
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Controls
|
||||
namespace Controls;
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Represents a TextBox that can update the binding on enter.
|
||||
/// </summary>
|
||||
public class TextBoxEx : TextBox
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Represents a TextBox that can update the binding on enter.
|
||||
/// </summary>
|
||||
public class TextBoxEx : TextBox
|
||||
{
|
||||
/// <summary>
|
||||
/// Identifies the <see cref="MoveFocusOnEnter"/> dependency property.
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty MoveFocusOnEnterProperty =
|
||||
DependencyProperty.Register(
|
||||
"MoveFocusOnEnter", typeof(bool), typeof(TextBoxEx), new UIPropertyMetadata(true));
|
||||
nameof(MoveFocusOnEnter), typeof(bool), typeof(TextBoxEx), new UIPropertyMetadata(true));
|
||||
|
||||
/// <summary>
|
||||
/// Identifies the <see cref="UpdateBindingOnEnter"/> dependency property.
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty UpdateBindingOnEnterProperty =
|
||||
DependencyProperty.Register(
|
||||
"UpdateBindingOnEnter", typeof(bool), typeof(TextBoxEx), new UIPropertyMetadata(true));
|
||||
nameof(UpdateBindingOnEnter), typeof(bool), typeof(TextBoxEx), new UIPropertyMetadata(true));
|
||||
|
||||
/// <summary>
|
||||
/// Identifies the <see cref="ScrollToHomeOnFocus"/> dependency property.
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty ScrollToHomeOnFocusProperty =
|
||||
DependencyProperty.Register("ScrollToHomeOnFocus", typeof(bool), typeof(TextBoxEx), new PropertyMetadata(true));
|
||||
DependencyProperty.Register(nameof(ScrollToHomeOnFocus), typeof(bool), typeof(TextBoxEx), new PropertyMetadata(true));
|
||||
|
||||
/// <summary>
|
||||
/// Identifies the <see cref="SelectAllOnFocus"/> dependency property.
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty SelectAllOnFocusProperty =
|
||||
DependencyProperty.Register("SelectAllOnFocus", typeof(bool), typeof(TextBoxEx), new PropertyMetadata(true));
|
||||
DependencyProperty.Register(nameof(SelectAllOnFocus), typeof(bool), typeof(TextBoxEx), new PropertyMetadata(true));
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
@ -161,5 +161,4 @@ namespace Controls
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +1,12 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace Controls
|
||||
namespace Controls;
|
||||
|
||||
/// <summary>
|
||||
/// A component of the symbol
|
||||
/// </summary>
|
||||
public readonly struct TextComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// A component of the symbol
|
||||
/// </summary>
|
||||
public readonly struct TextComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
@ -27,5 +27,4 @@ namespace Controls
|
||||
/// Style of the symbol component
|
||||
/// </summary>
|
||||
public readonly BaselineAlignment Style;
|
||||
}
|
||||
}
|
@ -11,13 +11,13 @@ using Brushes = System.Windows.Media.Brushes;
|
||||
using FontFamily = System.Windows.Media.FontFamily;
|
||||
using Point = System.Windows.Point;
|
||||
|
||||
namespace Controls
|
||||
namespace Controls;
|
||||
|
||||
/// <summary>
|
||||
/// Makes an Bitmap from every Imageformat.
|
||||
/// </summary>
|
||||
public sealed class ObjectImageConverter : IValueConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// Makes an Bitmap from every Imageformat.
|
||||
/// </summary>
|
||||
public sealed class ObjectImageConverter : IValueConverter
|
||||
{
|
||||
object IValueConverter.Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
const string dynResPrefix = "dynRes:";
|
||||
@ -82,19 +82,18 @@ namespace Controls
|
||||
var geometry = formattedText.BuildGeometry(new Point(0, 0));
|
||||
return GetIcon(geometry, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invert boolean converter
|
||||
/// </summary>
|
||||
[ValueConversion(typeof(bool), typeof(bool))]
|
||||
public class InverseBooleanConverter : IValueConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// Invert boolean converter
|
||||
/// </summary>
|
||||
[ValueConversion(typeof(bool), typeof(bool))]
|
||||
public class InverseBooleanConverter : IValueConverter
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) =>
|
||||
value is bool b ? !b : throw new InvalidOperationException("The target must be a boolean");
|
||||
|
||||
/// <inheritdoc />
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => Binding.DoNothing;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user