mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-06 06:55:04 +00:00
Renamed BindingHelper
This commit is contained in:
parent
df501f6b8b
commit
3a0e3bd226
2 changed files with 3 additions and 3 deletions
32
MapControl/Shared/BindingHelper.cs
Normal file
32
MapControl/Shared/BindingHelper.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
|
||||
// © 2021 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
#if WINDOWS_UWP
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Data;
|
||||
#else
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
#endif
|
||||
|
||||
namespace MapControl
|
||||
{
|
||||
internal static class PropertyHelper
|
||||
{
|
||||
public static Binding GetBinding(this object sourceObject, string sourceProperty)
|
||||
{
|
||||
return new Binding { Source = sourceObject, Path = new PropertyPath(sourceProperty) };
|
||||
}
|
||||
|
||||
public static void ValidateProperty(
|
||||
this FrameworkElement targetObject, DependencyProperty targetProperty, object sourceObject, string sourceProperty)
|
||||
{
|
||||
if (targetObject.GetValue(targetProperty) == null &&
|
||||
targetObject.GetBindingExpression(targetProperty) == null)
|
||||
{
|
||||
targetObject.SetBinding(targetProperty, sourceObject.GetBinding(sourceProperty));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue