Files
CustomerPanel-Test/Converter/VisibilityConverters.cs
2026-03-05 09:56:57 +01:00

43 lines
1.2 KiB
C#

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;
}
}
}