Browse Source

StyleResources -> ResourceDictionary.

And move it to the `Avalonia.Controls` namespace.
pull/1136/head
Steven Kirk 9 years ago
parent
commit
fec2823537
  1. 6
      src/Avalonia.Styling/Controls/ResourceDictionary.cs
  2. 7
      src/Avalonia.Styling/Styling/Style.cs
  3. 8
      tests/Avalonia.Styling.UnitTests/ResourceTests.cs

6
src/Avalonia.Styling/Styling/StyleResources.cs → src/Avalonia.Styling/Controls/ResourceDictionary.cs

@ -2,12 +2,12 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
namespace Avalonia.Styling namespace Avalonia.Controls
{ {
/// <summary> /// <summary>
/// Holds resources for a <see cref="Style"/>. /// An indexed dictionary of resources.
/// </summary> /// </summary>
public class StyleResources : IDictionary<string, object>, IDictionary public class ResourceDictionary : IDictionary<string, object>, IDictionary
{ {
private Dictionary<string, object> _inner = new Dictionary<string, object>(); private Dictionary<string, object> _inner = new Dictionary<string, object>();

7
src/Avalonia.Styling/Styling/Style.cs

@ -4,6 +4,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reactive.Linq; using System.Reactive.Linq;
using Avalonia.Controls;
using Avalonia.Metadata; using Avalonia.Metadata;
namespace Avalonia.Styling namespace Avalonia.Styling
@ -16,7 +17,7 @@ namespace Avalonia.Styling
private static Dictionary<IStyleable, List<IDisposable>> _applied = private static Dictionary<IStyleable, List<IDisposable>> _applied =
new Dictionary<IStyleable, List<IDisposable>>(); new Dictionary<IStyleable, List<IDisposable>>();
private StyleResources _resources; private ResourceDictionary _resources;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="Style"/> class. /// Initializes a new instance of the <see cref="Style"/> class.
@ -37,13 +38,13 @@ namespace Avalonia.Styling
/// <summary> /// <summary>
/// Gets or sets a dictionary of style resources. /// Gets or sets a dictionary of style resources.
/// </summary> /// </summary>
public StyleResources Resources public ResourceDictionary Resources
{ {
get get
{ {
if (_resources == null) if (_resources == null)
{ {
_resources = new StyleResources(); _resources = new ResourceDictionary();
} }
return _resources; return _resources;

8
tests/Avalonia.Styling.UnitTests/ResourceTests.cs

@ -20,7 +20,7 @@ namespace Avalonia.Styling.UnitTests
{ {
new Style new Style
{ {
Resources = new StyleResources Resources = new ResourceDictionary
{ {
{ "Foo", "foo resource" }, { "Foo", "foo resource" },
{ "Bar", "overridden" }, { "Bar", "overridden" },
@ -33,14 +33,14 @@ namespace Avalonia.Styling.UnitTests
{ {
new Style new Style
{ {
Resources = new StyleResources Resources = new ResourceDictionary
{ {
{ "Bar", "again overridden" }, { "Bar", "again overridden" },
} }
}, },
new Style new Style
{ {
Resources = new StyleResources Resources = new ResourceDictionary
{ {
{ "Bar", "bar resource" }, { "Bar", "bar resource" },
} }
@ -64,7 +64,7 @@ namespace Avalonia.Styling.UnitTests
{ {
new Style new Style
{ {
Resources = new StyleResources Resources = new ResourceDictionary
{ {
{ "Foo", "foo" }, { "Foo", "foo" },
} }

Loading…
Cancel
Save