зеркало из https://github.com/DeGsoft/maui-linux.git
Родитель
8821301e7e
Коммит
bfd3ad6491
|
@ -891,7 +891,7 @@ namespace Xamarin.Forms.Core.UnitTests
|
|||
}
|
||||
|
||||
[Test]
|
||||
public void IsSetIsTrueWhenPropCleared()
|
||||
public void IsSetIsFalseWhenPropCleared()
|
||||
{
|
||||
string defaultValue = "default";
|
||||
string newValue = "new value";
|
||||
|
@ -900,11 +900,9 @@ namespace Xamarin.Forms.Core.UnitTests
|
|||
var bindable = new MockBindable();
|
||||
|
||||
bindable.SetValue(bindableProperty, newValue);
|
||||
|
||||
bindable.ClearValue(bindableProperty);
|
||||
|
||||
var isSet = bindable.IsSet(bindableProperty);
|
||||
Assert.IsTrue(isSet);
|
||||
Assert.That(bindable.IsSet(bindableProperty), Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -924,7 +922,7 @@ namespace Xamarin.Forms.Core.UnitTests
|
|||
}
|
||||
|
||||
[Test]
|
||||
public void IsSetIsTrueWhenPropSetByDefaultValueCreator()
|
||||
public void IsSetIsFalseWhenPropSetByDefaultValueCreator()
|
||||
{
|
||||
string defaultValue = "default";
|
||||
string defaultValueC = "defaultVC";
|
||||
|
@ -941,7 +939,7 @@ namespace Xamarin.Forms.Core.UnitTests
|
|||
Assert.AreEqual(defaultValueC, created);
|
||||
|
||||
var isSet = bindable.IsSet(bindableProperty);
|
||||
Assert.IsTrue(isSet);
|
||||
Assert.IsFalse(isSet);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -1552,4 +1550,4 @@ namespace Xamarin.Forms.Core.UnitTests
|
|||
Assert.That(() => binding.Path = "Foo", Throws.Nothing);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,9 @@ namespace Xamarin.Forms
|
|||
if (targetProperty == null)
|
||||
throw new ArgumentNullException(nameof(targetProperty));
|
||||
|
||||
return GetContext(targetProperty) != null;
|
||||
var bpcontext = GetContext(targetProperty);
|
||||
return bpcontext != null
|
||||
&& (bpcontext.Attributes & BindableContextAttributes.IsDefaultValue) == 0;
|
||||
}
|
||||
|
||||
public object GetValue(BindableProperty property)
|
||||
|
@ -178,14 +180,6 @@ namespace Xamarin.Forms
|
|||
return bpcontext != null && bpcontext.Binding != null;
|
||||
}
|
||||
|
||||
internal bool GetIsDefault(BindableProperty targetProperty)
|
||||
{
|
||||
if (targetProperty == null)
|
||||
throw new ArgumentNullException(nameof(targetProperty));
|
||||
|
||||
return GetContext(targetProperty) == null;
|
||||
}
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public object[] GetValues(BindableProperty property0, BindableProperty property1)
|
||||
{
|
||||
|
|
|
@ -123,35 +123,35 @@ namespace Xamarin.Forms
|
|||
|
||||
static void OnOrderPropertyChanged(BindableObject bindable, object oldValue, object newValue)
|
||||
{
|
||||
if (bindable.GetIsDefault(FlexItemProperty))
|
||||
if (!bindable.IsSet(FlexItemProperty))
|
||||
return;
|
||||
GetFlexItem(bindable).Order = (int)newValue;
|
||||
}
|
||||
|
||||
static void OnGrowPropertyChanged(BindableObject bindable, object oldValue, object newValue)
|
||||
{
|
||||
if (bindable.GetIsDefault(FlexItemProperty))
|
||||
if (!bindable.IsSet(FlexItemProperty))
|
||||
return;
|
||||
GetFlexItem(bindable).Grow = (float)newValue;
|
||||
}
|
||||
|
||||
static void OnShrinkPropertyChanged(BindableObject bindable, object oldValue, object newValue)
|
||||
{
|
||||
if (bindable.GetIsDefault(FlexItemProperty))
|
||||
if (!bindable.IsSet(FlexItemProperty))
|
||||
return;
|
||||
GetFlexItem(bindable).Shrink = (float)newValue;
|
||||
}
|
||||
|
||||
static void OnAlignSelfPropertyChanged(BindableObject bindable, object oldValue, object newValue)
|
||||
{
|
||||
if (bindable.GetIsDefault(FlexItemProperty))
|
||||
if (!bindable.IsSet(FlexItemProperty))
|
||||
return;
|
||||
GetFlexItem(bindable).AlignSelf = (Flex.AlignSelf)(FlexAlignSelf)newValue;
|
||||
}
|
||||
|
||||
static void OnBasisPropertyChanged(BindableObject bindable, object oldValue, object newValue)
|
||||
{
|
||||
if (bindable.GetIsDefault(FlexItemProperty))
|
||||
if (!bindable.IsSet(FlexItemProperty))
|
||||
return;
|
||||
GetFlexItem(bindable).Basis = ((FlexBasis)newValue).ToFlexBasis();
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace Xamarin.Forms
|
|||
|
||||
public static bool GoToState(VisualElement visualElement, string name)
|
||||
{
|
||||
if (visualElement.GetIsDefault(VisualStateGroupsProperty))
|
||||
if (!visualElement.IsSet(VisualStateGroupsProperty))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ namespace Xamarin.Forms
|
|||
|
||||
public static bool HasVisualStateGroups(this VisualElement element)
|
||||
{
|
||||
return !element.GetIsDefault(VisualStateGroupsProperty);
|
||||
return element.IsSet(VisualStateGroupsProperty);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче