|
using System.Windows.Markup;
using System.Windows.Data;
using System.Windows;
using System.Windows.Media;
namespace SelectionAreaSample
{
public sealed class LineGeometryConverter : MarkupExtension, IValueConverter
{
public override object ProvideValue(System.IServiceProvider serviceProvider)
{
return this;
}
#region IValueConverter Members
public object Convert(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
var p = (Point)value;
var group = new GeometryGroup();
group.Children.Add(new LineGeometry(new Point(p.X, 0), new Point(p.X, 10000)));
group.Children.Add(new LineGeometry(new Point(0, p.Y), new Point(10000, p.Y)));
return group;
}
public object ConvertBack(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new System.NotImplementedException();
}
#endregion
}
}
|
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.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.