|
@@ -26,12 +26,13 @@ namespace Avalonia.Controls
|
|
|
|
|
|
|
|
static ProgressBar()
|
|
static ProgressBar()
|
|
|
{
|
|
{
|
|
|
|
|
+ PseudoClass(OrientationProperty, o => o == Avalonia.Controls.Orientation.Vertical, ":vertical");
|
|
|
|
|
+ PseudoClass(OrientationProperty, o => o == Avalonia.Controls.Orientation.Horizontal, ":horizontal");
|
|
|
|
|
+
|
|
|
ValueProperty.Changed.AddClassHandler<ProgressBar>(x => x.ValueChanged);
|
|
ValueProperty.Changed.AddClassHandler<ProgressBar>(x => x.ValueChanged);
|
|
|
|
|
|
|
|
IsIndeterminateProperty.Changed.AddClassHandler<ProgressBar>(
|
|
IsIndeterminateProperty.Changed.AddClassHandler<ProgressBar>(
|
|
|
(p, e) => { if (p._indicator != null) p.UpdateIsIndeterminate((bool)e.NewValue); });
|
|
(p, e) => { if (p._indicator != null) p.UpdateIsIndeterminate((bool)e.NewValue); });
|
|
|
- OrientationProperty.Changed.AddClassHandler<ProgressBar>(
|
|
|
|
|
- (p, e) => { if (p._indicator != null) p.UpdateOrientation((Orientation)e.NewValue); });
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public bool IsIndeterminate
|
|
public bool IsIndeterminate
|
|
@@ -59,7 +60,6 @@ namespace Avalonia.Controls
|
|
|
_indicator = e.NameScope.Get<Border>("PART_Indicator");
|
|
_indicator = e.NameScope.Get<Border>("PART_Indicator");
|
|
|
|
|
|
|
|
UpdateIndicator(Bounds.Size);
|
|
UpdateIndicator(Bounds.Size);
|
|
|
- UpdateOrientation(Orientation);
|
|
|
|
|
UpdateIsIndeterminate(IsIndeterminate);
|
|
UpdateIsIndeterminate(IsIndeterminate);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -86,26 +86,6 @@ namespace Avalonia.Controls
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private void UpdateOrientation(Orientation orientation)
|
|
|
|
|
- {
|
|
|
|
|
- if (orientation == Orientation.Horizontal)
|
|
|
|
|
- {
|
|
|
|
|
- MinHeight = 14;
|
|
|
|
|
- MinWidth = 200;
|
|
|
|
|
-
|
|
|
|
|
- _indicator.HorizontalAlignment = HorizontalAlignment.Left;
|
|
|
|
|
- _indicator.VerticalAlignment = VerticalAlignment.Stretch;
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- MinHeight = 200;
|
|
|
|
|
- MinWidth = 14;
|
|
|
|
|
-
|
|
|
|
|
- _indicator.HorizontalAlignment = HorizontalAlignment.Stretch;
|
|
|
|
|
- _indicator.VerticalAlignment = VerticalAlignment.Bottom;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
private void UpdateIsIndeterminate(bool isIndeterminate)
|
|
private void UpdateIsIndeterminate(bool isIndeterminate)
|
|
|
{
|
|
{
|
|
|
if (isIndeterminate)
|
|
if (isIndeterminate)
|