UpdateStyle();
}
- private bool IsViewPropertyDirty(BindableProperty styleProperty)
- {
- if (dirtyPropertySet.Count == 0)
- {
- return false;
- }
-
- return dirtyPropertySet.Contains(styleProperty.PropertyName);
- }
-
/// <summary>
/// Apply style instance to the view.
/// Basically it sets the bindable property to the value of the bindable property with same name in the style.
return;
}
- if (dirtyPropertySet == null)
- {
- dirtyPropertySet = new HashSet<string>();
- }
-
BindableProperty.GetBindablePropertysOfType(GetType(), out var bindablePropertyOfView);
if (bindablePropertyOfView == null)
foreach (var sourceProperty in dirtyStyleProperties)
{
- if (blockSetDirty && IsViewPropertyDirty(sourceProperty))
- {
- // Skip applying theme style for a property set by user.
- continue;
- }
-
var sourceValue = viewStyle.GetValue(sourceProperty);
if (sourceValue == null)
/// <since_tizen> 3 </since_tizen>
public partial class View
{
- private static bool blockSetDirty = false;
private ViewSelectorData selectorData;
- private HashSet<string> dirtyPropertySet;
internal string styleName;
return false;
}
- /// <summary>
- /// Call this method from a child class to notify that a change happened on a property.
- /// </summary>
- /// <param name="propertyName">The name of the property that changed.</param>
- [EditorBrowsable(EditorBrowsableState.Never)]
- protected override void OnPropertyChanged([CallerMemberName] string propertyName = null)
- {
- base.OnPropertyChanged(propertyName);
-
- if (!blockSetDirty)
- {
- dirtyPropertySet?.Add(propertyName);
- }
- }
-
private void DisConnectFromSignals()
{
// Save current CPtr.
if (newStyle != null)
{
- blockSetDirty = true;
ApplyStyle(newStyle);
- blockSetDirty = false;
}
}