chore: add Object2BooleanReConverter.

This commit is contained in:
NaBian 2022-09-03 20:22:19 +08:00
parent 15e3170cf9
commit f4d47f5af3
6 changed files with 20 additions and 1 deletions

View File

@ -17,6 +17,7 @@
<converter:TreeViewItemMarginConverter x:Key="TreeViewItemMarginConverter" />
<converter:Color2HexStringConverter x:Key="Color2HexStringConverter" />
<converter:Object2BooleanConverter x:Key="Object2BooleanConverter" />
<converter:Object2BooleanReConverter x:Key="Object2BooleanReConverter" />
<converter:Boolean2StringConverter x:Key="Boolean2StringConverter" />
<converter:Int2StringConverter x:Key="Int2StringConverter" />
<converter:BorderClipConverter x:Key="BorderClipConverter" />

View File

@ -97,6 +97,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\EventToCommand.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\IEventArgsConverter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\MouseDragElementBehaviorEx.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\Object2BooleanReConverter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\Helper\FullScreenHelper.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Window\GlowWindow.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\EnumItem.cs" />

View File

@ -13,6 +13,7 @@
<converter:TreeViewItemMarginConverter x:Key="TreeViewItemMarginConverter"/>
<converter:Color2HexStringConverter x:Key="Color2HexStringConverter"/>
<converter:Object2BooleanConverter x:Key="Object2BooleanConverter"/>
<converter:Object2BooleanReConverter x:Key="Object2BooleanReConverter" />
<converter:Boolean2StringConverter x:Key="Boolean2StringConverter"/>
<converter:Int2StringConverter x:Key="Int2StringConverter"/>
<converter:BorderClipConverter x:Key="BorderClipConverter"/>

View File

@ -17,6 +17,7 @@
<converter:TreeViewItemMarginConverter x:Key="TreeViewItemMarginConverter" />
<converter:Color2HexStringConverter x:Key="Color2HexStringConverter" />
<converter:Object2BooleanConverter x:Key="Object2BooleanConverter" />
<converter:Object2BooleanReConverter x:Key="Object2BooleanReConverter" />
<converter:Boolean2StringConverter x:Key="Boolean2StringConverter" />
<converter:Int2StringConverter x:Key="Int2StringConverter" />
<converter:BorderClipConverter x:Key="BorderClipConverter" />

View File

@ -6,7 +6,7 @@ namespace HandyControl.Tools.Converter;
public class Object2BooleanConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => !(value is null);
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => value is not null;
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{

View File

@ -0,0 +1,15 @@
using System;
using System.Globalization;
using System.Windows.Data;
namespace HandyControl.Tools.Converter;
public class Object2BooleanReConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => value is null;
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotSupportedException();
}
}