Browse Source

Don't expose protected fields.

pull/11477/head
Steven Kirk 3 years ago
parent
commit
61be135c8c
  1. 6
      src/Avalonia.Controls.ColorPicker/ColorSlider/ColorSlider.cs
  2. 28
      src/Avalonia.Controls/Slider.cs

6
src/Avalonia.Controls.ColorPicker/ColorSlider/ColorSlider.cs

@ -98,10 +98,10 @@ namespace Avalonia.Controls.Primitives
int pixelWidth;
int pixelHeight;
if (base._track != null)
if (base.Track != null)
{
pixelWidth = Convert.ToInt32(base._track.Bounds.Width * scale);
pixelHeight = Convert.ToInt32(base._track.Bounds.Height * scale);
pixelWidth = Convert.ToInt32(base.Track.Bounds.Width * scale);
pixelHeight = Convert.ToInt32(base.Track.Bounds.Height * scale);
}
else
{

28
src/Avalonia.Controls/Slider.cs

@ -86,10 +86,10 @@ namespace Avalonia.Controls
TickBar.TicksProperty.AddOwner<Slider>();
// Slider required parts
protected bool _isDragging;
protected Track? _track;
protected Button? _decreaseButton;
protected Button? _increaseButton;
private bool _isDragging;
private Track? _track;
private Button? _decreaseButton;
private Button? _increaseButton;
private IDisposable? _decreaseButtonPressDispose;
private IDisposable? _decreaseButtonReleaseDispose;
private IDisposable? _increaseButtonSubscription;
@ -181,6 +181,26 @@ namespace Avalonia.Controls
set { SetValue(TickPlacementProperty, value); }
}
/// <summary>
/// Gets a value indicating whether the <see cref="Slider"/> is currently being dragged.
/// </summary>
protected bool IsDragging => _isDragging;
/// <summary>
/// Gets the <see cref="Track"/> part of the <see cref="Slider"/>.
/// </summary>
protected Track? Track => _track;
/// <summary>
/// Gets the <see cref="Button"/> that decreases the <see cref="Slider"/> value.
/// </summary>
protected Button? DecreaseButton => _decreaseButton;
/// <summary>
/// Gets the <see cref="Button"/> that increases the <see cref="Slider"/> value.
/// </summary>
protected Button? IncreaseButton => _increaseButton;
/// <inheritdoc/>
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
{

Loading…
Cancel
Save