Skip to content

Commit

Permalink
Don't declare property fields AvaloniaProperty<>.
Browse files Browse the repository at this point in the history
Instead use `StyledProperty<>`.
  • Loading branch information
grokys committed Dec 18, 2019
1 parent 42bbb5e commit 3a914c2
Show file tree
Hide file tree
Showing 15 changed files with 29 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
12 changes: 6 additions & 6 deletions src/Avalonia.Controls/GridSplitter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,37 +23,37 @@ public class GridSplitter : Thumb
/// <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);
Expand Down
4 changes: 2 additions & 2 deletions src/Avalonia.Controls/LayoutTransformControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion src/Avalonia.Controls/Presenters/ContentPresenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class ContentPresenter : Control, IContentPresenter
/// <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>
Expand Down
8 changes: 4 additions & 4 deletions src/Avalonia.Controls/Repeater/ItemsRepeater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class ItemsRepeater : Panel
/// <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>
Expand All @@ -40,16 +40,16 @@ public class ItemsRepeater : Panel
/// <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);
Expand Down
2 changes: 1 addition & 1 deletion src/Avalonia.Input/DragDrop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static class DragDrop
/// </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.
Expand Down
2 changes: 1 addition & 1 deletion src/Avalonia.ReactiveUI/ReactiveUserControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
4 changes: 2 additions & 2 deletions src/Avalonia.ReactiveUI/ReactiveWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -41,4 +41,4 @@ object IViewFor.ViewModel
set => ViewModel = (TViewModel)value;
}
}
}
}
4 changes: 2 additions & 2 deletions src/Avalonia.ReactiveUI/RoutedViewHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class RoutedViewHost : TransitioningContentControl, IActivatableView, IEn
/// <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>
Expand Down Expand Up @@ -118,4 +118,4 @@ private void NavigateToViewModel(object viewModel)
Content = viewInstance;
}
}
}
}
6 changes: 3 additions & 3 deletions src/Avalonia.ReactiveUI/TransitioningContentControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ public class TransitioningContentControl : ContentControl, IStyleable
/// <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>
Expand Down Expand Up @@ -72,4 +72,4 @@ private async void UpdateContentWithTransition(object content)
await PageTransition.Start(null, this, true);
}
}
}
}
4 changes: 2 additions & 2 deletions src/Avalonia.Visuals/Media/DashStyle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ public class DashStyle : Animatable, IDashStyle, IAffectsRender
/// <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;
Expand Down
2 changes: 1 addition & 1 deletion src/Avalonia.Visuals/Media/PolylineGeometry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class PolylineGeometry : Geometry
/// <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;
Expand Down
2 changes: 1 addition & 1 deletion src/Avalonia.Visuals/Media/TransformGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class TransformGroup : Transform
/// <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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ private PopupRoot CreateTarget(TopLevel popupParent)

private class TemplatedControlWithPopup : TemplatedControl
{
public static readonly AvaloniaProperty<Control> PopupContentProperty =
public static readonly StyledProperty<Control> PopupContentProperty =
AvaloniaProperty.Register<TemplatedControlWithPopup, Control>(nameof(PopupContent));

public TemplatedControlWithPopup()
Expand Down
2 changes: 1 addition & 1 deletion tests/Avalonia.Visuals.UnitTests/Media/GeometryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void Transform_Produces_Transformed_PlatformImpl()

private class TestGeometry : Geometry
{
public static readonly AvaloniaProperty<bool> FooProperty =
public static readonly StyledProperty<bool> FooProperty =
AvaloniaProperty.Register<TestGeometry, bool>(nameof(Foo));

static TestGeometry()
Expand Down

0 comments on commit 3a914c2

Please sign in to comment.