34 lines
948 B
C#
34 lines
948 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Data;
|
|
|
|
namespace GroupChannelList.Converters
|
|
{
|
|
public class BooleanToWidthConverter : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
if (null == value) return 0;
|
|
double width = double.NaN;
|
|
if (parameter != null)
|
|
{
|
|
try
|
|
{
|
|
width = double.Parse(parameter.ToString());
|
|
}
|
|
catch { }
|
|
}
|
|
return (bool)value ? width : 0;
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
}
|