mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-05 14:37:01 +00:00
Fixed casting bug in DependencyPropertyHelper
This commit is contained in:
parent
8b08a3b8e6
commit
d863c374c7
2 changed files with 16 additions and 4 deletions
|
|
@ -34,9 +34,15 @@ namespace MapControl
|
|||
Action<FrameworkElement, TValue, TValue> changed = null,
|
||||
bool inherits = false) // unused in WinUI/UWP
|
||||
{
|
||||
var metadata = changed != null
|
||||
? new PropertyMetadata(defaultValue, (o, e) => changed((FrameworkElement)o, (TValue)e.OldValue, (TValue)e.NewValue))
|
||||
: new PropertyMetadata(defaultValue);
|
||||
var metadata = changed == null
|
||||
? new PropertyMetadata(defaultValue)
|
||||
: new PropertyMetadata(defaultValue, (o, e) =>
|
||||
{
|
||||
if (o is FrameworkElement element)
|
||||
{
|
||||
changed(element, (TValue)e.OldValue, (TValue)e.NewValue);
|
||||
}
|
||||
});
|
||||
|
||||
return DependencyProperty.RegisterAttached(name, typeof(TValue), typeof(TOwner), metadata);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue