mirror of
https://github.com/holgerb83/ModernWpfPlayground.git
synced 2025-04-19 06:53:50 +02:00
cleanup
This commit is contained in:
parent
e6704c331f
commit
4293e60fa7
1164
Annotations.cs
1164
Annotations.cs
File diff suppressed because it is too large
Load Diff
2
App.xaml
2
App.xaml
@ -8,7 +8,7 @@
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<local:IntellisenseResources Source="/ModernWpf;component/DesignTime/DesignTimeResources.xaml" />
|
||||
<local:IntellisenseResourceDictionary Source="/ModernWpf;component/DesignTime/DesignTimeResources.xaml" />
|
||||
<ui:ThemeResources />
|
||||
<ui:XamlControlsResources />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
7
IntellisenseResourceDictionary.cs
Normal file
7
IntellisenseResourceDictionary.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace ModernWpfPlayground
|
||||
{
|
||||
public class IntellisenseResourceDictionary : ModernWpf.DesignTime.IntellisenseResourcesBase
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
namespace ModernWpfPlayground
|
||||
{
|
||||
public class IntellisenseResources : ModernWpf.DesignTime.IntellisenseResourcesBase
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -8,10 +8,6 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.8">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="ModernWpfUI" Version="0.8.1" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="4.7.0" />
|
||||
</ItemGroup>
|
||||
|
@ -1,11 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text.Json;
|
||||
using System.Windows;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace ModernWpfPlayground.MvvmStuff
|
||||
{
|
||||
@ -13,7 +9,7 @@ namespace ModernWpfPlayground.MvvmStuff
|
||||
{
|
||||
private readonly Dictionary<string, object> _values = new Dictionary<string, object>();
|
||||
|
||||
public IReadOnlyDictionary<string, object> Values => _values;
|
||||
protected IReadOnlyDictionary<string, object> Values => _values;
|
||||
|
||||
protected bool SetProperty<T>(T value, Action<T>? onChanged = null,
|
||||
[CallerMemberName] string? propertyName = null)
|
||||
@ -35,8 +31,6 @@ namespace ModernWpfPlayground.MvvmStuff
|
||||
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
|
||||
[NotifyPropertyChangedInvocator]
|
||||
[PublicAPI]
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
|
||||
{
|
||||
if (propertyName == null) throw new ArgumentNullException(nameof(propertyName));
|
||||
|
@ -22,15 +22,16 @@ namespace ModernWpfPlayground.PropertyPresenter2
|
||||
/// <summary>
|
||||
/// Returns the content of a description attribute of an enum.
|
||||
/// </summary>
|
||||
/// <param name="enumValue"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
private static string GetDescription(object enumValue)
|
||||
private static string GetDescription(object value)
|
||||
{
|
||||
if (!(value is Enum enumValue)) return string.Empty;
|
||||
var descriptionAttribute = enumValue.GetType()
|
||||
.GetField(enumValue.ToString()).GetCustomAttributes(false)
|
||||
.OfType<DescriptionAttribute>().FirstOrDefault();
|
||||
|
||||
return descriptionAttribute?.Description ?? enumValue.ToString();
|
||||
return descriptionAttribute?.Description ?? value.ToString();
|
||||
}
|
||||
|
||||
object IValueConverter.ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
|
@ -12,20 +12,20 @@ namespace ModernWpfPlayground.PropertyPresenter2
|
||||
/// <summary>
|
||||
/// Default data template. (currently Textbox)
|
||||
/// </summary>
|
||||
public DataTemplate DefaultDataTemplate { private get; set; }
|
||||
public DataTemplate? DefaultDataTemplate { private get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Data template for boolean. (currently Checkbox)
|
||||
/// </summary>
|
||||
public DataTemplate BooleanDataTemplate { private get; set; }
|
||||
public DataTemplate? BooleanDataTemplate { private get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Data template for enums. (currently Combobox)
|
||||
/// </summary>
|
||||
public DataTemplate EnumComboBoxDataTemplate { private get; set; }
|
||||
public DataTemplate? EnumComboBoxDataTemplate { private get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public override DataTemplate SelectTemplate(object item, DependencyObject container)
|
||||
public override DataTemplate? SelectTemplate(object item, DependencyObject container)
|
||||
{
|
||||
return item switch
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user