This repository has been archived on 2024-01-02. You can view files and clone it, but cannot push or open issues or pull requests.
Sic06/FrameworkLocal/UIClient/DataGridTransform/DataGrid/Microsoft/Windows/Controls/BooleanToSelectiveScrolling...

51 lines
1.8 KiB
C#
Raw Normal View History

2023-01-13 10:57:37 +08:00
//---------------------------------------------------------------------------
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//---------------------------------------------------------------------------
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace ExtendedGrid.Microsoft.Windows.Controls
{
/// <summary>
/// Converts Boolean to SelectiveScrollingOrientation based on the given parameter.
/// </summary>
[Localizability(LocalizationCategory.NeverLocalize)]
internal sealed class BooleanToSelectiveScrollingOrientationConverter : IValueConverter
{
/// <summary>
/// Convert Boolean to SelectiveScrollingOrientation
/// </summary>
/// <param name="value">Boolean</param>
/// <param name="targetType">SelectiveScrollingOrientation</param>
/// <param name="parameter">SelectiveScrollingOrientation that should be used when the Boolean is true</param>
/// <param name="culture">null</param>
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;
}
/// <summary>
/// Not implemented
/// </summary>
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}