|
using System;
using System.Globalization;
using System.Windows.Controls;
using System.Windows.Data;
namespace MatrixLib.Layout
{
/// <summary>
/// The value converter applied to bindings against properties of
/// MatrixGridChildMonitor that informs a MatrixGrid of the Grid.Row
/// and Grid.Column settings applied to its child elements.
/// </summary>
class MatrixGridChildConverter : IValueConverter
{
#region Constructor
public MatrixGridChildConverter(MatrixGrid matrixGrid)
{
_matrixGrid = matrixGrid;
}
#endregion // Constructor
#region IValueConverter Members
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is int)
{
int index = (int)value;
if (parameter == Grid.RowProperty)
_matrixGrid.InspectRowIndex(index);
else
_matrixGrid.InspectColumnIndex(index);
}
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotSupportedException();
}
#endregion // IValueConverter Members
#region Fields
readonly MatrixGrid _matrixGrid;
#endregion // Fields
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.