mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
35 lines
964 B
C#
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));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|