diff --git a/samples/ControlCatalog/Pages/CustomDrawingExampleControl.cs b/samples/ControlCatalog/Pages/CustomDrawingExampleControl.cs index 938c45a4e2..db74be7c08 100644 --- a/samples/ControlCatalog/Pages/CustomDrawingExampleControl.cs +++ b/samples/ControlCatalog/Pages/CustomDrawingExampleControl.cs @@ -16,10 +16,10 @@ namespace ControlCatalog.Pages private Point _cursorPoint; - public StyledProperty ScaleProperty = AvaloniaProperty.Register(nameof(Scale), 1.0d); + public static readonly StyledProperty ScaleProperty = AvaloniaProperty.Register(nameof(Scale), 1.0d); public double Scale { get => GetValue(ScaleProperty); set => SetValue(ScaleProperty, value); } - public StyledProperty RotationProperty = AvaloniaProperty.Register(nameof(Rotation)); + public static readonly StyledProperty RotationProperty = AvaloniaProperty.Register(nameof(Rotation)); /// /// Rotation, measured in Radians! /// @@ -33,10 +33,10 @@ namespace ControlCatalog.Pages } } - public StyledProperty ViewportCenterYProperty = AvaloniaProperty.Register(nameof(ViewportCenterY), 0.0d); + public static readonly StyledProperty ViewportCenterYProperty = AvaloniaProperty.Register(nameof(ViewportCenterY), 0.0d); public double ViewportCenterY { get => GetValue(ViewportCenterYProperty); set => SetValue(ViewportCenterYProperty, value); } - public StyledProperty ViewportCenterXProperty = AvaloniaProperty.Register(nameof(ViewportCenterX), 0.0d); + public static readonly StyledProperty ViewportCenterXProperty = AvaloniaProperty.Register(nameof(ViewportCenterX), 0.0d); public double ViewportCenterX { get => GetValue(ViewportCenterXProperty); set => SetValue(ViewportCenterXProperty, value); } private IPen _pen; diff --git a/samples/ControlCatalog/Pages/PointerCanvas.cs b/samples/ControlCatalog/Pages/PointerCanvas.cs index da1ff5442d..653590fe64 100644 --- a/samples/ControlCatalog/Pages/PointerCanvas.cs +++ b/samples/ControlCatalog/Pages/PointerCanvas.cs @@ -93,7 +93,7 @@ public class PointerCanvas : Control } private int _threadSleep; - public static DirectProperty ThreadSleepProperty = + public static readonly DirectProperty ThreadSleepProperty = AvaloniaProperty.RegisterDirect(nameof(ThreadSleep), c => c.ThreadSleep, (c, v) => c.ThreadSleep = v); public int ThreadSleep @@ -103,7 +103,7 @@ public class PointerCanvas : Control } private bool _drawOnlyPoints; - public static DirectProperty DrawOnlyPointsProperty = + public static readonly DirectProperty DrawOnlyPointsProperty = AvaloniaProperty.RegisterDirect(nameof(DrawOnlyPoints), c => c.DrawOnlyPoints, (c, v) => c.DrawOnlyPoints = v); public bool DrawOnlyPoints @@ -113,7 +113,7 @@ public class PointerCanvas : Control } private string? _status; - public static DirectProperty StatusProperty = + public static readonly DirectProperty StatusProperty = AvaloniaProperty.RegisterDirect(nameof(DrawOnlyPoints), c => c.Status, (c, v) => c.Status = v, defaultBindingMode: Avalonia.Data.BindingMode.TwoWay); diff --git a/src/Avalonia.Controls/PullToRefresh/RefreshInfoProvider.cs b/src/Avalonia.Controls/PullToRefresh/RefreshInfoProvider.cs index 847f011fa9..d2667b6198 100644 --- a/src/Avalonia.Controls/PullToRefresh/RefreshInfoProvider.cs +++ b/src/Avalonia.Controls/PullToRefresh/RefreshInfoProvider.cs @@ -17,16 +17,16 @@ namespace Avalonia.Controls.PullToRefresh private double _interactionRatio; private bool _entered; - public DirectProperty IsInteractingForRefreshProperty = + public static readonly DirectProperty IsInteractingForRefreshProperty = AvaloniaProperty.RegisterDirect(nameof(IsInteractingForRefresh), s => s.IsInteractingForRefresh, (s, o) => s.IsInteractingForRefresh = o); - public DirectProperty ExecutionRatioProperty = + public static readonly DirectProperty ExecutionRatioProperty = AvaloniaProperty.RegisterDirect(nameof(ExecutionRatio), s => s.ExecutionRatio); - public DirectProperty InteractionRatioProperty = + public static readonly DirectProperty InteractionRatioProperty = AvaloniaProperty.RegisterDirect(nameof(InteractionRatio), s => s.InteractionRatio, (s, o) => s.InteractionRatio = o); diff --git a/src/Avalonia.Controls/PullToRefresh/RefreshVisualizer.cs b/src/Avalonia.Controls/PullToRefresh/RefreshVisualizer.cs index d2a35bb6aa..8dc19eb1d4 100644 --- a/src/Avalonia.Controls/PullToRefresh/RefreshVisualizer.cs +++ b/src/Avalonia.Controls/PullToRefresh/RefreshVisualizer.cs @@ -64,7 +64,7 @@ namespace Avalonia.Controls /// /// Defines the property. /// - internal DirectProperty RefreshInfoProviderProperty = + internal static readonly DirectProperty RefreshInfoProviderProperty = AvaloniaProperty.RegisterDirect(nameof(RefreshInfoProvider), s => s.RefreshInfoProvider, (s, o) => s.RefreshInfoProvider = o);