From b525a2ffccd2f2b6b57395cd7614846b8f99a085 Mon Sep 17 00:00:00 2001 From: NaBian <836904362@qq.com> Date: Fri, 23 Jul 2021 00:07:44 +0800 Subject: [PATCH] fixed #900 --- .../Controls/Slider/PreviewSlider.cs | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/Shared/HandyControl_Shared/Controls/Slider/PreviewSlider.cs b/src/Shared/HandyControl_Shared/Controls/Slider/PreviewSlider.cs index ecbb7023..0d449ba1 100644 --- a/src/Shared/HandyControl_Shared/Controls/Slider/PreviewSlider.cs +++ b/src/Shared/HandyControl_Shared/Controls/Slider/PreviewSlider.cs @@ -110,7 +110,7 @@ namespace HandyControl.Controls } _transform.X = p.X - _previewContent.ActualWidth * 0.5; - _transform.Y = -_previewContent.ActualHeight - PreviewContentOffset; + _transform.Y = _thumb.TranslatePoint(new Point(), _adorner).Y - _previewContent.ActualHeight - PreviewContentOffset; PreviewPosition = _thumb.IsMouseCaptureWithin ? Value : pos; } @@ -128,7 +128,7 @@ namespace HandyControl.Controls return; } - _transform.X = -_previewContent.ActualWidth - PreviewContentOffset; + _transform.X = _thumb.TranslatePoint(new Point(), _adorner).X -_previewContent.ActualWidth - PreviewContentOffset; _transform.Y = p.Y - _previewContent.ActualHeight * 0.5; PreviewPosition = _thumb.IsMouseCaptureWithin ? Value : pos; @@ -194,18 +194,10 @@ namespace HandyControl.Controls if (_previewContent != null) { _transform = new TranslateTransform(); - _previewContent.RenderTransform = _transform; - if (Orientation == Orientation.Horizontal) - { - _previewContent.HorizontalAlignment = HorizontalAlignment.Left; - _previewContent.VerticalAlignment = VerticalAlignment.Center; - } - else - { - _previewContent.HorizontalAlignment = HorizontalAlignment.Center; - _previewContent.VerticalAlignment = VerticalAlignment.Top; - } + _previewContent.HorizontalAlignment = HorizontalAlignment.Left; + _previewContent.VerticalAlignment = VerticalAlignment.Top; + _previewContent.RenderTransform = _transform; } } }