//---------------------------------------------------------------------------
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//---------------------------------------------------------------------------
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace ExtendedGrid.Microsoft.Windows.Controls
{
///
/// Converts Boolean to SelectiveScrollingOrientation based on the given parameter.
///
[Localizability(LocalizationCategory.NeverLocalize)]
internal sealed class BooleanToSelectiveScrollingOrientationConverter : IValueConverter
{
///
/// Convert Boolean to SelectiveScrollingOrientation
///
/// Boolean
/// SelectiveScrollingOrientation
/// SelectiveScrollingOrientation that should be used when the Boolean is true
/// null
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is bool && parameter is SelectiveScrollingOrientation)
{
var valueAsBool = (bool)value;
var parameterSelectiveScrollingOrientation = (SelectiveScrollingOrientation)parameter;
if (valueAsBool)
{
return parameterSelectiveScrollingOrientation;
}
}
return SelectiveScrollingOrientation.Both;
}
///
/// Not implemented
///
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}