XAML-Map-Control/MapControl/WPF/GeoImage.WPF.cs
2022-01-16 18:39:50 +01:00

35 lines
964 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
namespace MapControl
{
public partial class GeoImage : FrameworkElement
{
public BitmapSource Source
{
get { return (BitmapSource)GetValue(SourceProperty); }
set { SetValue(SourceProperty, value); }
}
public static readonly DependencyProperty SourceProperty =
DependencyProperty.Register(nameof(Source), typeof(BitmapSource), typeof(GeoImage),
new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender));
protected override void OnRender(DrawingContext drawingContext)
{
if (Source != null)
{
drawingContext.DrawImage(Source, new Rect(RenderSize));
}
}
}
}