Browse Source

Don't declare property fields AvaloniaProperty<>.

Instead use `StyledProperty<>`.
Steven Kirk 6 years ago
parent
commit
3a914c282b

+ 1 - 1
src/Avalonia.Controls.DataGrid/Primitives/DataGridFrozenGrid.cs

@@ -14,7 +14,7 @@ namespace Avalonia.Controls.Primitives
     /// </summary>
     public class DataGridFrozenGrid : Grid
     {
-        public static readonly AvaloniaProperty<bool> IsFrozenProperty =
+        public static readonly StyledProperty<bool> IsFrozenProperty =
             AvaloniaProperty.RegisterAttached<DataGridFrozenGrid, Control, bool>("IsFrozen");
 
         /// <summary>

+ 6 - 6
src/Avalonia.Controls/GridSplitter.cs

@@ -23,37 +23,37 @@ namespace Avalonia.Controls
         /// <summary>
         /// Defines the <see cref="ResizeDirection"/> property.
         /// </summary>
-        public static readonly AvaloniaProperty<GridResizeDirection> ResizeDirectionProperty =
+        public static readonly StyledProperty<GridResizeDirection> ResizeDirectionProperty =
             AvaloniaProperty.Register<GridSplitter, GridResizeDirection>(nameof(ResizeDirection));
 
         /// <summary>
         /// Defines the <see cref="ResizeBehavior"/> property.
         /// </summary>
-        public static readonly AvaloniaProperty<GridResizeBehavior> ResizeBehaviorProperty =
+        public static readonly StyledProperty<GridResizeBehavior> ResizeBehaviorProperty =
             AvaloniaProperty.Register<GridSplitter, GridResizeBehavior>(nameof(ResizeBehavior));
 
         /// <summary>
         /// Defines the <see cref="ShowsPreview"/> property.
         /// </summary>
-        public static readonly AvaloniaProperty<bool> ShowsPreviewProperty =
+        public static readonly StyledProperty<bool> ShowsPreviewProperty =
             AvaloniaProperty.Register<GridSplitter, bool>(nameof(ShowsPreview));
 
         /// <summary>
         /// Defines the <see cref="KeyboardIncrement"/> property.
         /// </summary>
-        public static readonly AvaloniaProperty<double> KeyboardIncrementProperty =
+        public static readonly StyledProperty<double> KeyboardIncrementProperty =
             AvaloniaProperty.Register<GridSplitter, double>(nameof(KeyboardIncrement), 10d);
 
         /// <summary>
         /// Defines the <see cref="DragIncrement"/> property.
         /// </summary>
-        public static readonly AvaloniaProperty<double> DragIncrementProperty =
+        public static readonly StyledProperty<double> DragIncrementProperty =
             AvaloniaProperty.Register<GridSplitter, double>(nameof(DragIncrement), 1d);
 
         /// <summary>
         /// Defines the <see cref="PreviewContent"/> property.
         /// </summary>
-        public static readonly AvaloniaProperty<ITemplate<IControl>> PreviewContentProperty =
+        public static readonly StyledProperty<ITemplate<IControl>> PreviewContentProperty =
             AvaloniaProperty.Register<GridSplitter, ITemplate<IControl>>(nameof(PreviewContent));
 
         private static readonly Cursor s_columnSplitterCursor = new Cursor(StandardCursorType.SizeWestEast);

+ 2 - 2
src/Avalonia.Controls/LayoutTransformControl.cs

@@ -17,10 +17,10 @@ namespace Avalonia.Controls
     /// </summary>
     public class LayoutTransformControl : Decorator
     {
-        public static readonly AvaloniaProperty<Transform> LayoutTransformProperty =
+        public static readonly StyledProperty<Transform> LayoutTransformProperty =
             AvaloniaProperty.Register<LayoutTransformControl, Transform>(nameof(LayoutTransform));
 
-        public static readonly AvaloniaProperty<bool> UseRenderTransformProperty =
+        public static readonly StyledProperty<bool> UseRenderTransformProperty =
             AvaloniaProperty.Register<LayoutTransformControl, bool>(nameof(LayoutTransform));
 
         static LayoutTransformControl()

+ 1 - 1
src/Avalonia.Controls/Presenters/ContentPresenter.cs

@@ -28,7 +28,7 @@ namespace Avalonia.Controls.Presenters
         /// <summary>
         /// Defines the <see cref="BorderBrush"/> property.
         /// </summary>
-        public static readonly AvaloniaProperty<IBrush> BorderBrushProperty =
+        public static readonly StyledProperty<IBrush> BorderBrushProperty =
             Border.BorderBrushProperty.AddOwner<ContentPresenter>();
 
         /// <summary>

+ 4 - 4
src/Avalonia.Controls/Repeater/ItemsRepeater.cs

@@ -22,7 +22,7 @@ namespace Avalonia.Controls
         /// <summary>
         /// Defines the <see cref="HorizontalCacheLength"/> property.
         /// </summary>
-        public static readonly AvaloniaProperty<double> HorizontalCacheLengthProperty =
+        public static readonly StyledProperty<double> HorizontalCacheLengthProperty =
             AvaloniaProperty.Register<ItemsRepeater, double>(nameof(HorizontalCacheLength), 2.0);
 
         /// <summary>
@@ -40,16 +40,16 @@ namespace Avalonia.Controls
         /// <summary>
         /// Defines the <see cref="Layout"/> property.
         /// </summary>
-        public static readonly AvaloniaProperty<AttachedLayout> LayoutProperty =
+        public static readonly StyledProperty<AttachedLayout> LayoutProperty =
             AvaloniaProperty.Register<ItemsRepeater, AttachedLayout>(nameof(Layout), new StackLayout());
 
         /// <summary>
         /// Defines the <see cref="VerticalCacheLength"/> property.
         /// </summary>
-        public static readonly AvaloniaProperty<double> VerticalCacheLengthProperty =
+        public static readonly StyledProperty<double> VerticalCacheLengthProperty =
             AvaloniaProperty.Register<ItemsRepeater, double>(nameof(VerticalCacheLength), 2.0);
 
-        private static readonly AttachedProperty<VirtualizationInfo> VirtualizationInfoProperty =
+        private static readonly StyledProperty<VirtualizationInfo> VirtualizationInfoProperty =
             AvaloniaProperty.RegisterAttached<ItemsRepeater, IControl, VirtualizationInfo>("VirtualizationInfo");
 
         internal static readonly Rect InvalidRect = new Rect(-1, -1, -1, -1);

+ 1 - 1
src/Avalonia.Input/DragDrop.cs

@@ -23,7 +23,7 @@ namespace Avalonia.Input
         /// </summary>
         public static readonly RoutedEvent<DragEventArgs> DropEvent = RoutedEvent.Register<DragEventArgs>("Drop", RoutingStrategies.Bubble, typeof(DragDrop));
 
-        public static readonly AvaloniaProperty<bool> AllowDropProperty = AvaloniaProperty.RegisterAttached<Interactive, bool>("AllowDrop", typeof(DragDrop), inherits: true);
+        public static readonly AttachedProperty<bool> AllowDropProperty = AvaloniaProperty.RegisterAttached<Interactive, bool>("AllowDrop", typeof(DragDrop), inherits: true);
 
         /// <summary>
         /// Gets a value indicating whether the given element can be used as the target of a drag-and-drop operation. 

+ 1 - 1
src/Avalonia.ReactiveUI/ReactiveUserControl.cs

@@ -15,7 +15,7 @@ namespace Avalonia.ReactiveUI
     /// <typeparam name="TViewModel">ViewModel type.</typeparam>
     public class ReactiveUserControl<TViewModel> : UserControl, IViewFor<TViewModel> where TViewModel : class
     {
-        public static readonly AvaloniaProperty<TViewModel> ViewModelProperty = AvaloniaProperty
+        public static readonly StyledProperty<TViewModel> ViewModelProperty = AvaloniaProperty
             .Register<ReactiveUserControl<TViewModel>, TViewModel>(nameof(ViewModel));
 
         /// <summary>

+ 2 - 2
src/Avalonia.ReactiveUI/ReactiveWindow.cs

@@ -15,7 +15,7 @@ namespace Avalonia.ReactiveUI
     /// <typeparam name="TViewModel">ViewModel type.</typeparam>
     public class ReactiveWindow<TViewModel> : Window, IViewFor<TViewModel> where TViewModel : class
     {
-        public static readonly AvaloniaProperty<TViewModel> ViewModelProperty = AvaloniaProperty
+        public static readonly StyledProperty<TViewModel> ViewModelProperty = AvaloniaProperty
             .Register<ReactiveWindow<TViewModel>, TViewModel>(nameof(ViewModel));
 
         /// <summary>
@@ -41,4 +41,4 @@ namespace Avalonia.ReactiveUI
             set => ViewModel = (TViewModel)value;
         }
     }
-}
+}

+ 2 - 2
src/Avalonia.ReactiveUI/RoutedViewHost.cs

@@ -58,7 +58,7 @@ namespace Avalonia.ReactiveUI
         /// <summary>
         /// <see cref="AvaloniaProperty"/> for the <see cref="Router"/> property.
         /// </summary>
-        public static readonly AvaloniaProperty<RoutingState> RouterProperty =
+        public static readonly StyledProperty<RoutingState> RouterProperty =
             AvaloniaProperty.Register<RoutedViewHost, RoutingState>(nameof(Router));
     
         /// <summary>
@@ -118,4 +118,4 @@ namespace Avalonia.ReactiveUI
             Content = viewInstance;
         }
     }
-}
+}

+ 3 - 3
src/Avalonia.ReactiveUI/TransitioningContentControl.cs

@@ -16,14 +16,14 @@ namespace Avalonia.ReactiveUI
         /// <summary>
         /// <see cref="AvaloniaProperty"/> for the <see cref="PageTransition"/> property.
         /// </summary>
-        public static readonly AvaloniaProperty<IPageTransition> PageTransitionProperty =
+        public static readonly StyledProperty<IPageTransition> PageTransitionProperty =
             AvaloniaProperty.Register<TransitioningContentControl, IPageTransition>(nameof(PageTransition),
                 new CrossFade(TimeSpan.FromSeconds(0.5)));
 
         /// <summary>
         /// <see cref="AvaloniaProperty"/> for the <see cref="DefaultContent"/> property.
         /// </summary>
-        public static readonly AvaloniaProperty<object> DefaultContentProperty =
+        public static readonly StyledProperty<object> DefaultContentProperty =
             AvaloniaProperty.Register<TransitioningContentControl, object>(nameof(DefaultContent));
         
         /// <summary>
@@ -72,4 +72,4 @@ namespace Avalonia.ReactiveUI
                 await PageTransition.Start(null, this, true);
         }
     }
-}
+}

+ 2 - 2
src/Avalonia.Visuals/Media/DashStyle.cs

@@ -14,13 +14,13 @@ namespace Avalonia.Media
         /// <summary>
         /// Defines the <see cref="Dashes"/> property.
         /// </summary>
-        public static readonly AvaloniaProperty<IReadOnlyList<double>> DashesProperty =
+        public static readonly StyledProperty<IReadOnlyList<double>> DashesProperty =
             AvaloniaProperty.Register<DashStyle, IReadOnlyList<double>>(nameof(Dashes));
 
         /// <summary>
         /// Defines the <see cref="Offset"/> property.
         /// </summary>
-        public static readonly AvaloniaProperty<double> OffsetProperty =
+        public static readonly StyledProperty<double> OffsetProperty =
             AvaloniaProperty.Register<DashStyle, double>(nameof(Offset));
 
         private static ImmutableDashStyle s_dash;

+ 1 - 1
src/Avalonia.Visuals/Media/PolylineGeometry.cs

@@ -23,7 +23,7 @@ namespace Avalonia.Media
         /// <summary>
         /// Defines the <see cref="IsFilled"/> property.
         /// </summary>
-        public static readonly AvaloniaProperty<bool> IsFilledProperty =
+        public static readonly StyledProperty<bool> IsFilledProperty =
             AvaloniaProperty.Register<PolylineGeometry, bool>(nameof(IsFilled));
 
         private Points _points;

+ 1 - 1
src/Avalonia.Visuals/Media/TransformGroup.cs

@@ -11,7 +11,7 @@ namespace Avalonia.Media
         /// <summary>
         /// Defines the <see cref="Children"/> property.
         /// </summary>
-        public static readonly AvaloniaProperty<Transforms> ChildrenProperty =
+        public static readonly StyledProperty<Transforms> ChildrenProperty =
             AvaloniaProperty.Register<TransformGroup, Transforms>(nameof(Children));
 
         public TransformGroup()

+ 1 - 1
tests/Avalonia.Controls.UnitTests/Primitives/PopupRootTests.cs

@@ -194,7 +194,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
 
         private class TemplatedControlWithPopup : TemplatedControl
         {
-            public static readonly AvaloniaProperty<Control> PopupContentProperty =
+            public static readonly StyledProperty<Control> PopupContentProperty =
                 AvaloniaProperty.Register<TemplatedControlWithPopup, Control>(nameof(PopupContent));
 
             public TemplatedControlWithPopup()

+ 1 - 1
tests/Avalonia.Visuals.UnitTests/Media/GeometryTests.cs

@@ -84,7 +84,7 @@ namespace Avalonia.Visuals.UnitTests.Media
 
         private class TestGeometry : Geometry
         {
-            public static readonly AvaloniaProperty<bool> FooProperty =
+            public static readonly StyledProperty<bool> FooProperty =
                 AvaloniaProperty.Register<TestGeometry, bool>(nameof(Foo));
 
             static TestGeometry()