initial
This commit is contained in:
42
Converter/VisibilityConverters.cs
Normal file
42
Converter/VisibilityConverters.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Markup;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace C4IT_CustomerPanel.Converter
|
||||
{
|
||||
public class BooleanToVisibiliyConverter : MarkupExtension, IValueConverter
|
||||
{
|
||||
public Visibility TrueValue { get; set; } = Visibility.Visible;
|
||||
public Visibility FalseValue { get; set; } = Visibility.Collapsed;
|
||||
|
||||
public object Convert(
|
||||
object value, Type targetType, object parameter,
|
||||
CultureInfo culture)
|
||||
{
|
||||
if (!(value is bool))
|
||||
return FalseValue;
|
||||
|
||||
return (bool)value ? TrueValue :
|
||||
FalseValue;
|
||||
}
|
||||
|
||||
public object ConvertBack(
|
||||
object value, Type targetType, object parameter,
|
||||
CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override object ProvideValue(IServiceProvider serviceProvider)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user