This repository has been archived on 2025-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
BreCal/src/BreCalClient/BoolToIndexConverter.cs

24 lines
611 B
C#

// Copyright (c) 2023 schick Informatik
// Description: Helper for combobox binding of bool to combobox
//
using System;
using System.Globalization;
using System.Windows.Data;
namespace BreCalClient
{
public class BoolToIndexConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return ((bool) value == true) ? 0 : 1;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return ((int)value == 0);
}
}
}