Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NUI] Public RemoveBinding and ClearBinding api #5634

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 15 additions & 30 deletions src/Tizen.NUI/src/public/XamlBinding/BindableObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,7 @@ public object BindingContext
[EditorBrowsable(EditorBrowsableState.Never)]
public int LinePosition { get; set; } = -1;

void IDynamicResourceHandler.SetDynamicResource(BindableProperty property, string key)
{
SetDynamicResource(property, key, false);
}
void IDynamicResourceHandler.SetDynamicResource(BindableProperty property, string key) => SetDynamicResource(property, key, false);

/// <summary>
/// Raised when a property has changed.
Expand Down Expand Up @@ -136,10 +133,7 @@ public void CopyBindingRelationShip(BindableObject other)
[EditorBrowsable(EditorBrowsableState.Never)]
public event EventHandler BindingContextChanged;

internal void ClearValue(BindableProperty property, bool fromStyle)
{
ClearValue(property, fromStyle: fromStyle, checkAccess: true);
}
internal void ClearValue(BindableProperty property, bool fromStyle) => ClearValue(property, fromStyle: fromStyle, checkAccess: true);

/// <summary>
/// Clears any value set by Tizen.NUI.Xaml.BindableObject.SetValue.
Expand Down Expand Up @@ -213,7 +207,8 @@ public object GetValue(BindableProperty property)
/// Removes a previously set binding.
/// </summary>
/// <param name="property">The BindableProperty from which to remove bindings.</param>
internal void RemoveBinding(BindableProperty property)
[EditorBrowsable(EditorBrowsableState.Never)]
public void RemoveBinding(BindableProperty property)
{
if (property == null)
throw new ArgumentNullException(nameof(property));
Expand All @@ -232,10 +227,7 @@ internal void RemoveBinding(BindableProperty property)
/// <param name="binding">The binding to set.</param>
/// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public void SetBinding(BindableProperty targetProperty, BindingBase binding)
{
SetBinding(targetProperty, binding, false);
}
public void SetBinding(BindableProperty targetProperty, BindingBase binding) => SetBinding(targetProperty, binding, false);

/// Internal used, will never changed to not hidden.
[EditorBrowsable(EditorBrowsableState.Never)]
Expand Down Expand Up @@ -326,6 +318,7 @@ internal void InternalSetValue(BindableProperty property, object value)
context.Value = value;
}

property.PropertyChanging?.Invoke(this, oldvalue, value);
property.PropertyChanged?.Invoke(this, oldvalue, value);

OnPropertyChanged(property.PropertyName);
Expand Down Expand Up @@ -423,10 +416,7 @@ public static void RegisterPropertyGroup(BindableProperty property, HashSet<Bind
/// </summary>
/// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
protected void ApplyBindings()
{
ApplyBindings(skipBindingContext: false, fromBindingContextChanged: false);
}
protected void ApplyBindings() => ApplyBindings(skipBindingContext: false, fromBindingContextChanged: false);

/// <summary>
/// Override this method to execute an action when the BindingContext changes.
Expand Down Expand Up @@ -650,10 +640,7 @@ bool CanBeSetFromStyle(BindableProperty property)
return false;
}

internal void SetDynamicResource(BindableProperty property, string key)
{
SetDynamicResource(property, key, false);
}
internal void SetDynamicResource(BindableProperty property, string key) => SetDynamicResource(property, key, false);

internal void SetDynamicResource(BindableProperty property, string key, bool fromStyle)
{
Expand All @@ -675,10 +662,7 @@ internal void SetDynamicResource(BindableProperty property, string key, bool fro
OnSetDynamicResource(property, key);
}

internal void SetValue(BindableProperty property, object value, bool fromStyle)
{
SetValue(property, value, fromStyle, true);
}
internal void SetValue(BindableProperty property, object value, bool fromStyle) => SetValue(property, value, fromStyle, true);

internal void SetValueCore(BindablePropertyKey propertyKey, object value, SetValueFlags attributes = SetValueFlags.None)
{
Expand All @@ -692,10 +676,7 @@ internal void SetValueCore(BindablePropertyKey propertyKey, object value, SetVal
/// <param name="value">The value to set</param>
/// <param name="attributes">The set value flag</param>
[EditorBrowsable(EditorBrowsableState.Never)]
internal void SetValueCore(BindableProperty property, object value, SetValueFlags attributes = SetValueFlags.None)
{
SetValueCore(property, value, attributes, SetValuePrivateFlags.Default);
}
internal void SetValueCore(BindableProperty property, object value, SetValueFlags attributes = SetValueFlags.None) => SetValueCore(property, value, attributes, SetValuePrivateFlags.Default);

internal void SetValueCore(BindableProperty property, object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes)
{
Expand Down Expand Up @@ -1115,7 +1096,11 @@ internal void ReplaceBindingElement(Dictionary<string, object> oldNameScope, Dic
}
}

internal void ClearBinding()
/// <summary>
/// Unapplies all previously set bindings.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public void ClearBinding()
{
foreach (var property in properties)
{
Expand Down