✨ 增加隐藏标题功能
This commit is contained in:
39
Converts/Boolean2VisibilityConverter.cs
Normal file
39
Converts/Boolean2VisibilityConverter.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace GeekDesk.Converts
|
||||
{
|
||||
internal class Boolean2VisibilityConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
bool param = false;
|
||||
if (value != null)
|
||||
{
|
||||
param = (bool)value;
|
||||
}
|
||||
if (param)
|
||||
{
|
||||
return Visibility.Visible;
|
||||
} else
|
||||
{
|
||||
return (Visibility)parameter;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if ((bool)value)
|
||||
{
|
||||
return Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Visibility.Hidden;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user