mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-06 06:55:04 +00:00
Updated MapContentControl, MapItem, MapPath
This commit is contained in:
parent
2dc7431c25
commit
7cfb80520b
18 changed files with 216 additions and 133 deletions
|
|
@ -7,8 +7,8 @@ namespace MapControl
|
|||
public partial class MapPath : Shape
|
||||
{
|
||||
public static readonly DependencyProperty DataProperty =
|
||||
Path.DataProperty.AddOwner(typeof(MapPath),
|
||||
new FrameworkPropertyMetadata(null, (o, e) => ((MapPath)o).DataPropertyChanged(e)));
|
||||
DependencyPropertyHelper.AddOwner<MapPath, Geometry>(Path.DataProperty,
|
||||
(path, oldValue, newValue) => path.DataPropertyChanged(oldValue, newValue));
|
||||
|
||||
public Geometry Data
|
||||
{
|
||||
|
|
@ -18,29 +18,15 @@ namespace MapControl
|
|||
|
||||
protected override Geometry DefiningGeometry => Data;
|
||||
|
||||
protected void SetDataTransform(Matrix matrix)
|
||||
{
|
||||
if (Data.Transform is MatrixTransform transform && !transform.IsFrozen)
|
||||
{
|
||||
transform.Matrix = matrix;
|
||||
}
|
||||
else
|
||||
{
|
||||
Data.Transform = new MatrixTransform(matrix);
|
||||
}
|
||||
}
|
||||
|
||||
private void DataPropertyChanged(DependencyPropertyChangedEventArgs e)
|
||||
private void DataPropertyChanged(Geometry oldValue, Geometry newValue)
|
||||
{
|
||||
// Check if Data is actually a new Geometry.
|
||||
//
|
||||
if (e.NewValue != null && !ReferenceEquals(e.NewValue, e.OldValue))
|
||||
if (newValue != null && !ReferenceEquals(newValue, oldValue))
|
||||
{
|
||||
var data = (Geometry)e.NewValue;
|
||||
|
||||
if (data.IsFrozen)
|
||||
if (newValue.IsFrozen)
|
||||
{
|
||||
Data = data.Clone(); // DataPropertyChanged called again
|
||||
Data = newValue.Clone(); // DataPropertyChanged called again
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue