增加Null2VisibilityConverter
value是null的时候隐藏,不为null显示
This commit is contained in:
1 parent
939d776b36
commit
4729cbfdab
3 files changed
+22
No files matched your search
@@ -156,6 +156,7 @@
|
||||
<Compile Include="Data\Gif\GPStream.cs" />
|
||||
<Compile Include="Tools\Converter\Boolean2StrConverter.cs" />
|
||||
<Compile Include="Tools\Converter\Int2StrConverter.cs" />
|
||||
<Compile Include="Tools\Converter\Null2VisibilityConverter.cs" />
|
||||
<Compile Include="Tools\Helper\ColorHelper.cs" />
|
||||
<Compile Include="Tools\GifImageAnimator.cs" />
|
||||
<Compile Include="Data\GrowlInfo.cs" />
|
||||
|
||||
@@ -15,5 +15,6 @@
|
||||
<converter:Object2BooleanConverter x:Key="Object2BooleanConverter"/>
|
||||
<converter:Boolean2StrConverter x:Key="Boolean2StrConverter"/>
|
||||
<converter:Int2StrConverter x:Key="Int2StrConverter"/>
|
||||
<converter:Null2VisibilityConverter x:Key="Null2VisibilityConverter"/>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace HandyControl.Tools.Converter
|
||||
{
|
||||
public class Null2VisibilityConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return value == null ? Visibility.Collapsed : Visibility.Visible;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user