|
@@ -14,7 +14,7 @@ namespace Avalonia.Styling
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// A style that consists of a number of child styles.
|
|
/// A style that consists of a number of child styles.
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
- public class Styles : AvaloniaObject, IAvaloniaList<IStyle>, IStyle, ISetStyleParent
|
|
|
|
|
|
|
+ public class Styles : AvaloniaObject, IAvaloniaList<IStyle>, IStyle, ISetResourceParent
|
|
|
{
|
|
{
|
|
|
private IResourceNode _parent;
|
|
private IResourceNode _parent;
|
|
|
private IResourceDictionary _resources;
|
|
private IResourceDictionary _resources;
|
|
@@ -27,10 +27,10 @@ namespace Avalonia.Styling
|
|
|
_styles.ForEachItem(
|
|
_styles.ForEachItem(
|
|
|
x =>
|
|
x =>
|
|
|
{
|
|
{
|
|
|
- if (x.ResourceParent == null && x is ISetStyleParent setParent)
|
|
|
|
|
|
|
+ if (x.ResourceParent == null && x is ISetResourceParent setParent)
|
|
|
{
|
|
{
|
|
|
setParent.SetParent(this);
|
|
setParent.SetParent(this);
|
|
|
- setParent.NotifyResourcesChanged(new ResourcesChangedEventArgs());
|
|
|
|
|
|
|
+ setParent.ParentResourcesChanged(new ResourcesChangedEventArgs());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (x.HasResources)
|
|
if (x.HasResources)
|
|
@@ -43,10 +43,10 @@ namespace Avalonia.Styling
|
|
|
},
|
|
},
|
|
|
x =>
|
|
x =>
|
|
|
{
|
|
{
|
|
|
- if (x.ResourceParent == this && x is ISetStyleParent setParent)
|
|
|
|
|
|
|
+ if (x.ResourceParent == this && x is ISetResourceParent setParent)
|
|
|
{
|
|
{
|
|
|
setParent.SetParent(null);
|
|
setParent.SetParent(null);
|
|
|
- setParent.NotifyResourcesChanged(new ResourcesChangedEventArgs());
|
|
|
|
|
|
|
+ setParent.ParentResourcesChanged(new ResourcesChangedEventArgs());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (x.HasResources)
|
|
if (x.HasResources)
|
|
@@ -98,7 +98,7 @@ namespace Avalonia.Styling
|
|
|
|
|
|
|
|
if (hadResources || _resources.Count > 0)
|
|
if (hadResources || _resources.Count > 0)
|
|
|
{
|
|
{
|
|
|
- ((ISetStyleParent)this).NotifyResourcesChanged(new ResourcesChangedEventArgs());
|
|
|
|
|
|
|
+ ((ISetResourceParent)this).ParentResourcesChanged(new ResourcesChangedEventArgs());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -246,7 +246,7 @@ namespace Avalonia.Styling
|
|
|
IEnumerator IEnumerable.GetEnumerator() => _styles.GetEnumerator();
|
|
IEnumerator IEnumerable.GetEnumerator() => _styles.GetEnumerator();
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
/// <inheritdoc/>
|
|
|
- void ISetStyleParent.SetParent(IResourceNode parent)
|
|
|
|
|
|
|
+ void ISetResourceParent.SetParent(IResourceNode parent)
|
|
|
{
|
|
{
|
|
|
if (_parent != null && parent != null)
|
|
if (_parent != null && parent != null)
|
|
|
{
|
|
{
|
|
@@ -257,7 +257,7 @@ namespace Avalonia.Styling
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
/// <inheritdoc/>
|
|
|
- void ISetStyleParent.NotifyResourcesChanged(ResourcesChangedEventArgs e)
|
|
|
|
|
|
|
+ void ISetResourceParent.ParentResourcesChanged(ResourcesChangedEventArgs e)
|
|
|
{
|
|
{
|
|
|
ResourcesChanged?.Invoke(this, e);
|
|
ResourcesChanged?.Invoke(this, e);
|
|
|
}
|
|
}
|
|
@@ -266,7 +266,7 @@ namespace Avalonia.Styling
|
|
|
{
|
|
{
|
|
|
foreach (var child in this)
|
|
foreach (var child in this)
|
|
|
{
|
|
{
|
|
|
- (child as ISetStyleParent)?.NotifyResourcesChanged(e);
|
|
|
|
|
|
|
+ (child as ISetResourceParent)?.ParentResourcesChanged(e);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
ResourcesChanged?.Invoke(this, e);
|
|
ResourcesChanged?.Invoke(this, e);
|
|
@@ -280,7 +280,7 @@ namespace Avalonia.Styling
|
|
|
{
|
|
{
|
|
|
if (foundSource)
|
|
if (foundSource)
|
|
|
{
|
|
{
|
|
|
- (child as ISetStyleParent)?.NotifyResourcesChanged(e);
|
|
|
|
|
|
|
+ (child as ISetResourceParent)?.ParentResourcesChanged(e);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
foundSource |= child == sender;
|
|
foundSource |= child == sender;
|