소스 검색

Renamed DataTemplate -> FuncDataTemplate.

Steven Kirk 10 년 전
부모
커밋
292a04d973

+ 1 - 1
samples/TestApplication/GalleryStyle.cs

@@ -61,7 +61,7 @@ namespace TestApplication
             {
                 DataTemplates = new DataTemplates
                 {
-                    new DataTemplate<string>(x => new Border
+                    new FuncDataTemplate<string>(x => new Border
                     {
                         [~Border.BackgroundProperty] = control[~TemplatedControl.BackgroundProperty],
                         Padding = new Thickness(10),

+ 1 - 1
samples/TestApplication/Program.cs

@@ -401,7 +401,7 @@ namespace TestApplication
 						Margin = new Thickness(10),
 						DataTemplates = new DataTemplates
 						{
-							new DataTemplate<Item>(x =>
+							new FuncDataTemplate<Item>(x =>
 								new StackPanel
 								{
 									Gap = 4,

+ 1 - 1
src/Perspex.Controls/ContentControl.cs

@@ -11,7 +11,7 @@ using Perspex.Layout;
 namespace Perspex.Controls
 {
     /// <summary>
-    /// Displays <see cref="Content"/> according to a <see cref="DataTemplate"/>.
+    /// Displays <see cref="Content"/> according to a <see cref="FuncDataTemplate"/>.
     /// </summary>
     public class ContentControl : TemplatedControl, IContentControl, IReparentingHost
     {

+ 1 - 1
src/Perspex.Controls/Generators/TreeItemContainerGenerator.cs

@@ -192,7 +192,7 @@ namespace Perspex.Controls.Generators
 
             if (template == null)
             {
-                template = DataTemplate.Default;
+                template = FuncDataTemplate.Default;
             }
 
             var treeTemplate = template as ITreeDataTemplate;

+ 1 - 1
src/Perspex.Controls/IContentControl.cs

@@ -7,7 +7,7 @@ namespace Perspex.Controls
 {
     /// <summary>
     /// Defines a control that displays <see cref="Content"/> according to a
-    /// <see cref="Perspex.Controls.Templates.DataTemplate"/>.
+    /// <see cref="Perspex.Controls.Templates.FuncDataTemplate"/>.
     /// </summary>
     public interface IContentControl : IControl
     {

+ 2 - 2
src/Perspex.Controls/Perspex.Controls.csproj

@@ -70,7 +70,7 @@
     <Compile Include="Primitives\ScrollInfoAdapter.cs" />
     <Compile Include="Canvas.cs" />
     <Compile Include="Templates\ControlTemplate`2.cs" />
-    <Compile Include="Templates\DataTemplate`1.cs" />
+    <Compile Include="Templates\FuncDataTemplate`1.cs" />
     <Compile Include="Templates\FuncMemberSelector.cs" />
     <Compile Include="Templates\IControlTemplate.cs" />
     <Compile Include="Templates\FuncTemplate`2.cs" />
@@ -100,7 +100,7 @@
     <Compile Include="Controls.cs" />
     <Compile Include="Templates\ControlTemplate.cs" />
     <Compile Include="Templates\DataTemplateExtensions.cs" />
-    <Compile Include="Templates\DataTemplate.cs" />
+    <Compile Include="Templates\FuncDataTemplate.cs" />
     <Compile Include="Generators\TreeItemContainerGenerator.cs" />
     <Compile Include="Generators\ItemContainerGenerator`1.cs" />
     <Compile Include="Generators\ItemContainerGenerator.cs" />

+ 1 - 1
src/Perspex.Controls/Templates/DataTemplateExtensions.cs

@@ -42,7 +42,7 @@ namespace Perspex.Controls.Templates
                     }
                     else
                     {
-                        result = DataTemplate.Default.Build(data);
+                        result = FuncDataTemplate.Default.Build(data);
                     }
 
                     result.DataContext = data;

+ 7 - 7
src/Perspex.Controls/Templates/DataTemplate.cs → src/Perspex.Controls/Templates/FuncDataTemplate.cs

@@ -9,13 +9,13 @@ namespace Perspex.Controls.Templates
     /// <summary>
     /// Builds a control for a piece of data.
     /// </summary>
-    public class DataTemplate : FuncTemplate<object, IControl>, IDataTemplate
+    public class FuncDataTemplate : FuncTemplate<object, IControl>, IDataTemplate
     {
         /// <summary>
         /// The default data template used in the case where not matching data template is found.
         /// </summary>
-        public static readonly DataTemplate Default =
-           new DataTemplate(typeof(object), o => (o != null) ? new TextBlock { Text = o.ToString() } : null);
+        public static readonly FuncDataTemplate Default =
+           new FuncDataTemplate(typeof(object), o => (o != null) ? new TextBlock { Text = o.ToString() } : null);
 
         /// <summary>
         /// The implementation of the <see cref="Match"/> method.
@@ -23,19 +23,19 @@ namespace Perspex.Controls.Templates
         private readonly Func<object, bool> _match;
 
         /// <summary>
-        /// Initializes a new instance of the <see cref="DataTemplate"/> class.
+        /// Initializes a new instance of the <see cref="FuncDataTemplate"/> class.
         /// </summary>
         /// <param name="type">The type of data which the data template matches.</param>
         /// <param name="build">
         /// A function which when passed an object of <paramref name="type"/> returns a control.
         /// </param>
-        public DataTemplate(Type type, Func<object, IControl> build)
+        public FuncDataTemplate(Type type, Func<object, IControl> build)
             : this(o => IsInstance(o, type), build)
         {
         }
 
         /// <summary>
-        /// Initializes a new instance of the <see cref="DataTemplate"/> class.
+        /// Initializes a new instance of the <see cref="FuncDataTemplate"/> class.
         /// </summary>
         /// <param name="match">
         /// A function which determines whether the data template matches the specified data.
@@ -43,7 +43,7 @@ namespace Perspex.Controls.Templates
         /// <param name="build">
         /// A function which returns a control for matching data.
         /// </param>
-        public DataTemplate(Func<object, bool> match, Func<object, IControl> build)
+        public FuncDataTemplate(Func<object, bool> match, Func<object, IControl> build)
             : base(build)
         {
             Contract.Requires<ArgumentNullException>(match != null);

+ 5 - 5
src/Perspex.Controls/Templates/DataTemplate`1.cs → src/Perspex.Controls/Templates/FuncDataTemplate`1.cs

@@ -9,21 +9,21 @@ namespace Perspex.Controls.Templates
     /// Builds a control for a piece of data of specified type.
     /// </summary>
     /// <typeparam name="T">The type of the template's data.</typeparam>
-    public class DataTemplate<T> : DataTemplate
+    public class FuncDataTemplate<T> : FuncDataTemplate
     {
         /// <summary>
-        /// Initializes a new instance of the <see cref="DataTemplate{T}"/> class.
+        /// Initializes a new instance of the <see cref="FuncDataTemplate{T}"/> class.
         /// </summary>
         /// <param name="build">
         /// A function which when passed an object of <typeparamref name="T"/> returns a control.
         /// </param>
-        public DataTemplate(Func<T, IControl> build)
+        public FuncDataTemplate(Func<T, IControl> build)
             : base(typeof(T), CastBuild(build))
         {
         }
 
         /// <summary>
-        /// Initializes a new instance of the <see cref="DataTemplate{T}"/> class.
+        /// Initializes a new instance of the <see cref="FuncDataTemplate{T}"/> class.
         /// </summary>
         /// <param name="match">
         /// A function which determines whether the data template matches the specified data.
@@ -31,7 +31,7 @@ namespace Perspex.Controls.Templates
         /// <param name="build">
         /// A function which when passed an object of <typeparamref name="T"/> returns a control.
         /// </param>
-        public DataTemplate(Func<T, bool> match, Func<T, IControl> build)
+        public FuncDataTemplate(Func<T, bool> match, Func<T, IControl> build)
             : base(CastMatch(match), CastBuild(build))
         {
         }

+ 1 - 1
src/Perspex.Controls/Templates/TreeDataTemplate.cs

@@ -10,7 +10,7 @@ namespace Perspex.Controls.Templates
     /// <summary>
     /// A template used to build hierachical data.
     /// </summary>
-    public class TreeDataTemplate : DataTemplate, ITreeDataTemplate
+    public class TreeDataTemplate : FuncDataTemplate, ITreeDataTemplate
     {
         private readonly Func<object, IEnumerable> _itemsSelector;
 

+ 2 - 2
src/Perspex.Themes.Default/MenuItemStyle.cs

@@ -21,8 +21,8 @@ namespace Perspex.Themes.Default
     /// </summary>
     public class MenuItemStyle : Styles
     {
-        private static readonly DataTemplate AccessKeyDataTemplate =
-            new DataTemplate<string>(x => new AccessText { Text = x });
+        private static readonly FuncDataTemplate AccessKeyDataTemplate =
+            new FuncDataTemplate<string>(x => new AccessText { Text = x });
 
         /// <summary>
         /// Initializes a new instance of the <see cref="MenuItemStyle"/> class.

+ 1 - 1
tests/Perspex.Controls.UnitTests/ItemsControlTests.cs

@@ -305,7 +305,7 @@ namespace Perspex.Controls.UnitTests
                 DataContext = "Base",
                 DataTemplates = new DataTemplates
                 {
-                    new DataTemplate<Item>(x => new Button { Content = x })
+                    new FuncDataTemplate<Item>(x => new Button { Content = x })
                 },
                 Items = items,
             };

+ 1 - 1
tests/Perspex.Controls.UnitTests/TabControlTests.cs

@@ -147,7 +147,7 @@ namespace Perspex.Controls.UnitTests
                 DataContext = "Base",
                 DataTemplates = new DataTemplates
                 {
-                    new DataTemplate<Item>(x => new Button { Content = x })
+                    new FuncDataTemplate<Item>(x => new Button { Content = x })
                 },
                 Items = items,
             };