ソースを参照

StyleResources -> ResourceDictionary.

And move it to the `Avalonia.Controls` namespace.
Steven Kirk 8 年 前
コミット
fec2823537

+ 3 - 3
src/Avalonia.Styling/Styling/StyleResources.cs → src/Avalonia.Styling/Controls/ResourceDictionary.cs

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

+ 4 - 3
src/Avalonia.Styling/Styling/Style.cs

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

+ 4 - 4
tests/Avalonia.Styling.UnitTests/ResourceTests.cs

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