Browse Source

Make sure Application.ResourcesChanged is raised.

Previously if `Application.ResourcesChanged` was null when `Resources` was created, adding the handler via `_resources.ResourcesChanged += ResourcesChanged` did nothing because `ResourcesChanged` was null.
pull/1978/head
Steven Kirk 8 years ago
parent
commit
5ac1430a06
  1. 9
      src/Avalonia.Controls/Application.cs

9
src/Avalonia.Controls/Application.cs

@ -122,11 +122,11 @@ namespace Avalonia
if (_resources != null)
{
hadResources = _resources.Count > 0;
_resources.ResourcesChanged -= ResourcesChanged;
_resources.ResourcesChanged -= ThisResourcesChanged;
}
_resources = value;
_resources.ResourcesChanged += ResourcesChanged;
_resources.ResourcesChanged += ThisResourcesChanged;
if (hadResources || _resources.Count > 0)
{
@ -343,5 +343,10 @@ namespace Avalonia
.Bind<IGlobalClock>().ToConstant(clock)
.GetService<IRenderLoop>()?.Add(clock);
}
private void ThisResourcesChanged(object sender, ResourcesChangedEventArgs e)
{
ResourcesChanged?.Invoke(this, e);
}
}
}

Loading…
Cancel
Save