This commit is contained in:
NaBian 2021-12-14 23:51:54 +08:00
parent 4748ba1678
commit 7897e2ab0a

View File

@ -25,8 +25,6 @@ namespace HandyControl.Controls
private TranslateTransform _translateTransform; private TranslateTransform _translateTransform;
public WaveProgressBar() => Loaded += (s, e) => UpdateWave(Value);
static WaveProgressBar() static WaveProgressBar()
{ {
FocusableProperty.OverrideMetadata(typeof(WaveProgressBar), new FrameworkPropertyMetadata(ValueBoxes.FalseBox)); FocusableProperty.OverrideMetadata(typeof(WaveProgressBar), new FrameworkPropertyMetadata(ValueBoxes.FalseBox));
@ -60,15 +58,19 @@ namespace HandyControl.Controls
if (_waveElement != null && clipElement != null) if (_waveElement != null && clipElement != null)
{ {
var clipElementHeight = clipElement.Height;
_translateTransform = new TranslateTransform _translateTransform = new TranslateTransform
{ {
Y = clipElement.Height Y = clipElementHeight
}; };
_translateTransformYRange = clipElement.Height - TranslateTransformMinY; _translateTransformYRange = clipElementHeight - TranslateTransformMinY;
_waveElement.RenderTransform = new TransformGroup _waveElement.RenderTransform = new TransformGroup
{ {
Children = { _translateTransform } Children = { _translateTransform }
}; };
UpdateWave(Value);
} }
} }