public class FlagBooleanConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
int param;
if (!int.TryParse(value.ToString(), out param))
{
return DependencyProperty.UnsetValue;
}
return param.Equals(1);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
bool param;
if (!bool.TryParse(value.ToString(), out param))
{
return DependencyProperty.UnsetValue;
}
return param ? 1 : 0;
}
}
0 件のコメント:
コメントを投稿