Browse Source

Don't declare property fields AvaloniaProperty<>.

Instead use `StyledProperty<>`.
pull/3255/head
Steven Kirk 6 years ago
parent
commit
3a914c282b
  1. 2
      src/Avalonia.Controls.DataGrid/Primitives/DataGridFrozenGrid.cs
  2. 12
      src/Avalonia.Controls/GridSplitter.cs
  3. 4
      src/Avalonia.Controls/LayoutTransformControl.cs
  4. 2
      src/Avalonia.Controls/Presenters/ContentPresenter.cs
  5. 8
      src/Avalonia.Controls/Repeater/ItemsRepeater.cs
  6. 2
      src/Avalonia.Input/DragDrop.cs
  7. 2
      src/Avalonia.ReactiveUI/ReactiveUserControl.cs
  8. 4
      src/Avalonia.ReactiveUI/ReactiveWindow.cs
  9. 4
      src/Avalonia.ReactiveUI/RoutedViewHost.cs
  10. 6
      src/Avalonia.ReactiveUI/TransitioningContentControl.cs
  11. 4
      src/Avalonia.Visuals/Media/DashStyle.cs
  12. 2
      src/Avalonia.Visuals/Media/PolylineGeometry.cs
  13. 2
      src/Avalonia.Visuals/Media/TransformGroup.cs
  14. 2
      tests/Avalonia.Controls.UnitTests/Primitives/PopupRootTests.cs
  15. 2
      tests/Avalonia.Visuals.UnitTests/Media/GeometryTests.cs

2
src/Avalonia.Controls.DataGrid/Primitives/DataGridFrozenGrid.cs

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

12
src/Avalonia.Controls/GridSplitter.cs

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

4
src/Avalonia.Controls/LayoutTransformControl.cs

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

2
src/Avalonia.Controls/Presenters/ContentPresenter.cs

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

8
src/Avalonia.Controls/Repeater/ItemsRepeater.cs

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

2
src/Avalonia.Input/DragDrop.cs

@ -23,7 +23,7 @@ namespace Avalonia.Input
/// </summary> /// </summary>
public static readonly RoutedEvent<DragEventArgs> DropEvent = RoutedEvent.Register<DragEventArgs>("Drop", RoutingStrategies.Bubble, typeof(DragDrop)); 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> /// <summary>
/// Gets a value indicating whether the given element can be used as the target of a drag-and-drop operation. /// Gets a value indicating whether the given element can be used as the target of a drag-and-drop operation.

2
src/Avalonia.ReactiveUI/ReactiveUserControl.cs

@ -15,7 +15,7 @@ namespace Avalonia.ReactiveUI
/// <typeparam name="TViewModel">ViewModel type.</typeparam> /// <typeparam name="TViewModel">ViewModel type.</typeparam>
public class ReactiveUserControl<TViewModel> : UserControl, IViewFor<TViewModel> where TViewModel : class 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)); .Register<ReactiveUserControl<TViewModel>, TViewModel>(nameof(ViewModel));
/// <summary> /// <summary>

4
src/Avalonia.ReactiveUI/ReactiveWindow.cs

@ -15,7 +15,7 @@ namespace Avalonia.ReactiveUI
/// <typeparam name="TViewModel">ViewModel type.</typeparam> /// <typeparam name="TViewModel">ViewModel type.</typeparam>
public class ReactiveWindow<TViewModel> : Window, IViewFor<TViewModel> where TViewModel : class 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)); .Register<ReactiveWindow<TViewModel>, TViewModel>(nameof(ViewModel));
/// <summary> /// <summary>
@ -41,4 +41,4 @@ namespace Avalonia.ReactiveUI
set => ViewModel = (TViewModel)value; set => ViewModel = (TViewModel)value;
} }
} }
} }

4
src/Avalonia.ReactiveUI/RoutedViewHost.cs

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

6
src/Avalonia.ReactiveUI/TransitioningContentControl.cs

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

4
src/Avalonia.Visuals/Media/DashStyle.cs

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

2
src/Avalonia.Visuals/Media/PolylineGeometry.cs

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

2
src/Avalonia.Visuals/Media/TransformGroup.cs

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

2
tests/Avalonia.Controls.UnitTests/Primitives/PopupRootTests.cs

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

2
tests/Avalonia.Visuals.UnitTests/Media/GeometryTests.cs

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

Loading…
Cancel
Save