diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/CoverFlowDemoCtl.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/CoverFlowDemoCtl.xaml.cs index c9cbf0bc..b482538a 100644 --- a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/CoverFlowDemoCtl.xaml.cs +++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/CoverFlowDemoCtl.xaml.cs @@ -21,7 +21,8 @@ namespace HandyControlDemo.UserControl new Uri(@"pack://application:,,,/Resources/Img/Album/9.jpg"), new Uri(@"pack://application:,,,/Resources/Img/Album/10.jpg") }); - CoverFlowMain.JumpTo(2); + + CoverFlowMain.PageIndex = 2; } } } diff --git a/src/Shared/HandyControl_Shared/Controls/Cover/CoverFlow/CoverFlow.cs b/src/Shared/HandyControl_Shared/Controls/Cover/CoverFlow/CoverFlow.cs index 1a1088af..aaa71b03 100644 --- a/src/Shared/HandyControl_Shared/Controls/Cover/CoverFlow/CoverFlow.cs +++ b/src/Shared/HandyControl_Shared/Controls/Cover/CoverFlow/CoverFlow.cs @@ -103,18 +103,13 @@ namespace HandyControl.Controls /// private int _lastShowIndex; - /// - /// 跳转编号 - /// - private int _jumpToIndex = -1; - /// /// 页码 /// public int PageIndex { get => (int) GetValue(PageIndexProperty); - internal set => SetValue(PageIndexProperty, value); + set => SetValue(PageIndexProperty, value); } /// @@ -147,11 +142,6 @@ namespace HandyControl.Controls _visualParent = GetTemplateChild(ElementVisualParent) as ModelVisual3D; UpdateShowRange(); - if (_jumpToIndex > 0) - { - PageIndex = _jumpToIndex; - _jumpToIndex = -1; - } _point3DAnimation = new Point3DAnimation(new Point3D(CoverFlowItem.Interval * PageIndex, _camera.Position.Y, _camera.Position.Z), new Duration(TimeSpan.FromMilliseconds(200))); _camera.BeginAnimation(ProjectionCamera.PositionProperty, _point3DAnimation); @@ -181,11 +171,6 @@ namespace HandyControl.Controls /// public void Add(Uri uri) => _contentDic.Add(_contentDic.Count, uri); - /// - /// 跳转 - /// - public void JumpTo(int index) => _jumpToIndex = index; - protected override void OnMouseWheel(MouseWheelEventArgs e) { base.OnMouseWheel(e); @@ -237,6 +222,11 @@ namespace HandyControl.Controls /// private void UpdateIndex(int newIndex) { + if (!IsLoaded) + { + return; + } + UpdateShowRange(); _itemShowDic.Do(item => {