示例#1
0
        private static void OnDisplayModePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            AySplitView sv = d as AySplitView;

            if (sv != null)
            {
                if (sv.LeftArea.IsNull())
                {
                    return;
                }
                DisplayModeOrPlacementChanged(sv);
            }
        }
示例#2
0
        private static void OnCompactPaneLengthPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            AySplitView sv = d as AySplitView;

            if (sv != null)
            {
                if (sv.LeftArea.IsNull())
                {
                    return;
                }
                OnLengthChanged(sv);
            }
        }
示例#3
0
 private static void CompactInlineOrCompactOverlay(AySplitView sv, bool isOpenValue)
 {
     if (sv.LeftArea.IsNull())
     {
         return;
     }
     if (isOpenValue) //从隐藏到显示
     {
         sv.LeftArea.Margin     = new Thickness(0, 0, 0, 0);
         sv.LeftArea.Visibility = Visibility.Visible;
         DoubleAnimationUsingKeyFrames LeftWidthKey = new DoubleAnimationUsingKeyFrames();
         LeftWidthKey.Duration     = new Duration(TimeSpan.FromMilliseconds(sv.OpenMillisecondTime));
         LeftWidthKey.FillBehavior = FillBehavior.Stop;
         double endWidth = sv.OpenPaneLength;
         EasingDoubleKeyFrame LeftWidthKey0 = new EasingDoubleKeyFrame(endWidth, KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(sv.OpenMillisecondTime)));
         LeftWidthKey.KeyFrames.Add(LeftWidthKey0);
         LeftWidthKey.Completed += (a, ed) =>
         {
             sv.LeftArea.Width = endWidth;
             LeftWidthKey      = null;
             #region 触发客户端定义的事件
             sv.OpenPaneCompletedChanged();
             #endregion
         };
         sv.LeftArea.BeginAnimation(ContentControl.WidthProperty, LeftWidthKey);
     }
     else //显示到隐藏
     {
         sv.LeftArea.Margin     = new Thickness(0, 0, 0, 0);
         sv.LeftArea.Visibility = Visibility.Visible;
         DoubleAnimationUsingKeyFrames LeftWidthKey = new DoubleAnimationUsingKeyFrames();
         LeftWidthKey.Duration     = new Duration(TimeSpan.FromMilliseconds(sv.OpenMillisecondTime));
         LeftWidthKey.FillBehavior = FillBehavior.Stop;
         double endWidth = sv.CompactPaneLength;
         EasingDoubleKeyFrame LeftWidthKey0 = new EasingDoubleKeyFrame(endWidth, KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(sv.OpenMillisecondTime)));
         LeftWidthKey.KeyFrames.Add(LeftWidthKey0);
         LeftWidthKey.Completed += (a, ed) =>
         {
             sv.LeftArea.Width = endWidth;
             LeftWidthKey      = null;
             #region 触发客户端定义的事件
             sv.ClosePaneCompletedChanged();
             #endregion
         };
         sv.LeftArea.BeginAnimation(ContentControl.WidthProperty, LeftWidthKey);
     }
 }
示例#4
0
        private static void OnPanePlacementPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            AySplitView sv = d as AySplitView;

            if (sv != null)
            {
                if (sv.LeftArea.IsNull())
                {
                    return;
                }
                DisplayModeOrPlacementChanged(sv);
                #region 触发客户端定义的事件
                SplitViewPanePlacement newValue = (SplitViewPanePlacement)e.NewValue;
                SplitViewPanePlacement oldValue = (SplitViewPanePlacement)e.OldValue;
                sv.PanePlacementValueChanged(oldValue, newValue);
                #endregion
            }
        }
示例#5
0
        private static void DisplayModeOrPlacementChanged(AySplitView sv)
        {
            if (sv.LeftArea.IsNull())
            {
                return;
            }
            if (sv.PanePlacement == SplitViewPanePlacement.Left || sv.PanePlacement == SplitViewPanePlacement.Right)
            {
                sv.rowTop.Height    = new GridLength(1, GridUnitType.Star);
                sv.rowBottom.Height = new GridLength(1, GridUnitType.Star);
                Grid.SetRowSpan(sv.LeftArea, 2);
                Grid.SetRowSpan(sv.ContentArea, 2);
                Grid.SetRow(sv.LeftArea, 0);
                Grid.SetRow(sv.ContentArea, 0);

                if (sv.PanePlacement == SplitViewPanePlacement.Left)
                {
                    sv.colContent.Width             = new GridLength(1, GridUnitType.Star);
                    sv.colLeft.Width                = GridLength.Auto;
                    sv.LeftArea.HorizontalAlignment = HorizontalAlignment.Left;
                    sv.LeftArea.VerticalAlignment   = VerticalAlignment.Stretch;

                    if (sv.DisplayMode == SplitViewDisplayMode.CompactOverlay || sv.DisplayMode == SplitViewDisplayMode.Overlay)
                    {
                        Grid.SetColumn(sv.LeftArea, 0);
                        Grid.SetColumn(sv.ContentArea, 0);
                        Grid.SetColumnSpan(sv.LeftArea, 2);
                        Grid.SetColumnSpan(sv.ContentArea, 2);
                        sv.LeftArea.Margin = new Thickness(0);
                    }
                    else
                    {
                        Grid.SetColumn(sv.LeftArea, 0);
                        Grid.SetColumn(sv.ContentArea, 1);
                        Grid.SetColumnSpan(sv.LeftArea, 1);
                        Grid.SetColumnSpan(sv.ContentArea, 1);
                    }
                }
                else if (sv.PanePlacement == SplitViewPanePlacement.Right)
                {
                    sv.colLeft.Width                = new GridLength(1, GridUnitType.Star);
                    sv.colContent.Width             = GridLength.Auto;
                    sv.LeftArea.HorizontalAlignment = HorizontalAlignment.Right;
                    sv.LeftArea.VerticalAlignment   = VerticalAlignment.Stretch;

                    if (sv.DisplayMode == SplitViewDisplayMode.CompactOverlay || sv.DisplayMode == SplitViewDisplayMode.Overlay)
                    {
                        Grid.SetColumn(sv.LeftArea, 0);
                        Grid.SetColumn(sv.ContentArea, 0);
                        Grid.SetColumnSpan(sv.LeftArea, 2);
                        Grid.SetColumnSpan(sv.ContentArea, 2);
                        sv.LeftArea.Margin = new Thickness(0);
                    }
                    else
                    {
                        Grid.SetColumn(sv.LeftArea, 1);
                        Grid.SetColumn(sv.ContentArea, 0);
                        Grid.SetColumnSpan(sv.LeftArea, 1);
                        Grid.SetColumnSpan(sv.ContentArea, 1);
                    }
                }

                OnLengthChanged(sv);
            }
            else //上下的处理www.ayjs.net 六安杨洋(AY)拓展 2016-6-24 11:33:54 ay花费2天
            {
                sv.colContent.Width = new GridLength(1, GridUnitType.Star);
                sv.colLeft.Width    = new GridLength(1, GridUnitType.Star);
                Grid.SetColumnSpan(sv.LeftArea, 2);
                Grid.SetColumnSpan(sv.ContentArea, 2);
                Grid.SetColumn(sv.LeftArea, 0);
                Grid.SetColumn(sv.ContentArea, 0);
                if (sv.PanePlacement == SplitViewPanePlacement.Top)
                {
                    sv.rowTop.Height                = GridLength.Auto;
                    sv.rowBottom.Height             = new GridLength(1, GridUnitType.Star);
                    sv.LeftArea.VerticalAlignment   = VerticalAlignment.Top;
                    sv.LeftArea.HorizontalAlignment = HorizontalAlignment.Stretch;

                    if (sv.DisplayMode == SplitViewDisplayMode.CompactOverlay || sv.DisplayMode == SplitViewDisplayMode.Overlay)
                    {
                        Grid.SetRow(sv.LeftArea, 0);
                        Grid.SetRow(sv.ContentArea, 0);
                        Grid.SetRowSpan(sv.LeftArea, 2);
                        Grid.SetRowSpan(sv.ContentArea, 2);
                        sv.LeftArea.Margin = new Thickness(0);
                    }
                    else
                    {
                        Grid.SetRow(sv.LeftArea, 0);
                        Grid.SetRow(sv.ContentArea, 1);
                        Grid.SetRowSpan(sv.LeftArea, 1);
                        Grid.SetRowSpan(sv.ContentArea, 1);
                    }
                }
                else if (sv.PanePlacement == SplitViewPanePlacement.Bottom)
                {
                    sv.rowBottom.Height = GridLength.Auto;
                    sv.rowTop.Height    = new GridLength(1, GridUnitType.Star);

                    sv.LeftArea.VerticalAlignment   = VerticalAlignment.Bottom;
                    sv.LeftArea.HorizontalAlignment = HorizontalAlignment.Stretch;


                    if (sv.DisplayMode == SplitViewDisplayMode.CompactOverlay || sv.DisplayMode == SplitViewDisplayMode.Overlay)
                    {
                        Grid.SetRow(sv.LeftArea, 0);
                        Grid.SetRow(sv.ContentArea, 0);
                        Grid.SetRowSpan(sv.LeftArea, 2);
                        Grid.SetRowSpan(sv.ContentArea, 2);
                        sv.LeftArea.Margin = new Thickness(0);
                    }
                    else
                    {
                        Grid.SetRow(sv.LeftArea, 1);
                        Grid.SetRow(sv.ContentArea, 0);
                        Grid.SetRowSpan(sv.LeftArea, 1);
                        Grid.SetRowSpan(sv.ContentArea, 1);
                    }
                }

                OnLengthChanged(sv);
            }
        }
示例#6
0
        private static void OnIsPaneOpenPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            AySplitView sv = d as AySplitView;

            if (sv != null)
            {
                if (sv.LeftArea.IsNull())
                {
                    return;
                }
                bool isOpenValue = (bool)e.NewValue;
                if (sv.PanePlacement == SplitViewPanePlacement.Left)
                {
                    Grid.SetRow(sv.LeftArea, 0);
                    Grid.SetRow(sv.ContentArea, 0);
                    sv.colContent.Width             = new GridLength(1, GridUnitType.Star);
                    sv.colLeft.Width                = GridLength.Auto;
                    sv.LeftArea.HorizontalAlignment = HorizontalAlignment.Left;
                    //inline效果
                    if (sv.DisplayMode == SplitViewDisplayMode.Inline)
                    {
                        Grid.SetColumn(sv.LeftArea, 0);
                        Grid.SetColumn(sv.ContentArea, 1);
                        Grid.SetColumnSpan(sv.LeftArea, 1);
                        Grid.SetColumnSpan(sv.ContentArea, 1);

                        InlineOrOverlay(sv, isOpenValue);
                    }
                    else if (sv.DisplayMode == SplitViewDisplayMode.Overlay)
                    {
                        Grid.SetColumn(sv.LeftArea, 0);
                        Grid.SetColumn(sv.ContentArea, 0);
                        Grid.SetColumnSpan(sv.LeftArea, 2);
                        Grid.SetColumnSpan(sv.ContentArea, 2);
                        InlineOrOverlay(sv, isOpenValue);
                    }
                    else if (sv.DisplayMode == SplitViewDisplayMode.CompactInline)//应该设置OpenPaneLength
                    {
                        Grid.SetColumn(sv.LeftArea, 0);
                        Grid.SetColumn(sv.ContentArea, 1);
                        Grid.SetColumnSpan(sv.LeftArea, 1);
                        Grid.SetColumnSpan(sv.ContentArea, 1);

                        CompactInlineOrCompactOverlay(sv, isOpenValue);
                    }
                    else if (sv.DisplayMode == SplitViewDisplayMode.CompactOverlay)
                    {
                        Grid.SetColumn(sv.LeftArea, 0);
                        Grid.SetColumn(sv.ContentArea, 0);
                        Grid.SetColumnSpan(sv.LeftArea, 2);
                        Grid.SetColumnSpan(sv.ContentArea, 2);
                        CompactInlineOrCompactOverlay(sv, isOpenValue);
                    }
                }
                else if (sv.PanePlacement == SplitViewPanePlacement.Right)
                {
                    Grid.SetRow(sv.LeftArea, 0);
                    Grid.SetRow(sv.ContentArea, 0);
                    sv.colContent.Width             = GridLength.Auto;
                    sv.colLeft.Width                = new GridLength(1, GridUnitType.Star);
                    sv.LeftArea.HorizontalAlignment = HorizontalAlignment.Right;
                    //inline效果
                    if (sv.DisplayMode == SplitViewDisplayMode.Inline)
                    {
                        Grid.SetColumn(sv.LeftArea, 1);
                        Grid.SetColumn(sv.ContentArea, 0);
                        Grid.SetColumnSpan(sv.LeftArea, 1);
                        Grid.SetColumnSpan(sv.ContentArea, 1);

                        InlineOrOverlayRight(sv, isOpenValue);
                    }
                    else if (sv.DisplayMode == SplitViewDisplayMode.Overlay)
                    {
                        Grid.SetColumn(sv.LeftArea, 0);
                        Grid.SetColumn(sv.ContentArea, 0);
                        Grid.SetColumnSpan(sv.LeftArea, 2);
                        Grid.SetColumnSpan(sv.ContentArea, 2);
                        InlineOrOverlayRight(sv, isOpenValue);
                    }
                    else if (sv.DisplayMode == SplitViewDisplayMode.CompactInline)//应该设置OpenPaneLength
                    {
                        Grid.SetColumn(sv.LeftArea, 1);
                        Grid.SetColumn(sv.ContentArea, 0);
                        Grid.SetColumnSpan(sv.LeftArea, 1);
                        Grid.SetColumnSpan(sv.ContentArea, 1);
                        CompactInlineOrCompactOverlay(sv, isOpenValue);
                    }
                    else if (sv.DisplayMode == SplitViewDisplayMode.CompactOverlay)
                    {
                        Grid.SetColumn(sv.LeftArea, 0);
                        Grid.SetColumn(sv.ContentArea, 0);
                        Grid.SetColumnSpan(sv.LeftArea, 2);
                        Grid.SetColumnSpan(sv.ContentArea, 2);
                        CompactInlineOrCompactOverlay(sv, isOpenValue);
                    }
                }
                else if (sv.PanePlacement == SplitViewPanePlacement.Top) //www.ayjs.net 六安杨洋(AY)拓展
                {
                    Grid.SetColumn(sv.LeftArea, 0);
                    Grid.SetColumn(sv.ContentArea, 0);
                    sv.rowTop.Height              = GridLength.Auto;
                    sv.rowBottom.Height           = new GridLength(1, GridUnitType.Star);
                    sv.LeftArea.VerticalAlignment = VerticalAlignment.Top;
                    //inline效果
                    if (sv.DisplayMode == SplitViewDisplayMode.Inline)
                    {
                        Grid.SetRow(sv.LeftArea, 0);
                        Grid.SetRow(sv.ContentArea, 1);
                        Grid.SetRowSpan(sv.LeftArea, 1);
                        Grid.SetRowSpan(sv.ContentArea, 1);


                        InlineOrOverlayTop(sv, isOpenValue);
                    }
                    else if (sv.DisplayMode == SplitViewDisplayMode.Overlay)
                    {
                        Grid.SetRow(sv.LeftArea, 0);
                        Grid.SetRow(sv.ContentArea, 0);
                        Grid.SetRowSpan(sv.LeftArea, 2);
                        Grid.SetRowSpan(sv.ContentArea, 2);

                        InlineOrOverlayTop(sv, isOpenValue);
                    }
                    else if (sv.DisplayMode == SplitViewDisplayMode.CompactInline)//应该设置OpenPaneLength
                    {
                        Grid.SetRow(sv.LeftArea, 0);
                        Grid.SetRow(sv.ContentArea, 1);
                        Grid.SetRowSpan(sv.LeftArea, 1);
                        Grid.SetRowSpan(sv.ContentArea, 1);
                        CompactInlineOrCompactOverlayTop(sv, isOpenValue);
                    }
                    else if (sv.DisplayMode == SplitViewDisplayMode.CompactOverlay)
                    {
                        Grid.SetRow(sv.LeftArea, 0);
                        Grid.SetRow(sv.ContentArea, 0);
                        Grid.SetRowSpan(sv.LeftArea, 2);
                        Grid.SetRowSpan(sv.ContentArea, 2);
                        CompactInlineOrCompactOverlayTop(sv, isOpenValue);
                    }
                }
                else if (sv.PanePlacement == SplitViewPanePlacement.Bottom) //www.ayjs.net 六安杨洋(AY)拓展
                {
                    Grid.SetColumn(sv.LeftArea, 0);
                    Grid.SetColumn(sv.ContentArea, 0);
                    sv.rowBottom.Height           = GridLength.Auto;
                    sv.rowTop.Height              = new GridLength(1, GridUnitType.Star);
                    sv.LeftArea.VerticalAlignment = VerticalAlignment.Bottom;
                    //inline效果
                    if (sv.DisplayMode == SplitViewDisplayMode.Inline)
                    {
                        Grid.SetRow(sv.LeftArea, 1);
                        Grid.SetRow(sv.ContentArea, 0);
                        Grid.SetRowSpan(sv.LeftArea, 1);
                        Grid.SetRowSpan(sv.ContentArea, 1);

                        InlineOrOverlayBottom(sv, isOpenValue);
                    }
                    else if (sv.DisplayMode == SplitViewDisplayMode.Overlay)
                    {
                        Grid.SetRow(sv.LeftArea, 0);
                        Grid.SetRow(sv.ContentArea, 0);
                        Grid.SetRowSpan(sv.LeftArea, 2);
                        Grid.SetRowSpan(sv.ContentArea, 2);

                        InlineOrOverlayBottom(sv, isOpenValue);
                    }
                    else if (sv.DisplayMode == SplitViewDisplayMode.CompactInline)//应该设置OpenPaneLength
                    {
                        Grid.SetRow(sv.LeftArea, 1);
                        Grid.SetRow(sv.ContentArea, 0);
                        Grid.SetRowSpan(sv.LeftArea, 1);
                        Grid.SetRowSpan(sv.ContentArea, 1);
                        CompactInlineOrCompactOverlayTop(sv, isOpenValue);
                    }
                    else if (sv.DisplayMode == SplitViewDisplayMode.CompactOverlay)
                    {
                        Grid.SetRow(sv.LeftArea, 0);
                        Grid.SetRow(sv.ContentArea, 0);
                        Grid.SetRowSpan(sv.LeftArea, 2);
                        Grid.SetRowSpan(sv.ContentArea, 2);
                        CompactInlineOrCompactOverlayTop(sv, isOpenValue);
                    }
                }
                #region 触发客户端定义的事件
                bool oldBool = (bool)e.OldValue;
                sv.IsPaneOpenValueChanged(oldBool, isOpenValue);
                #endregion
            }
        }
示例#7
0
        private static void OnLengthChanged(AySplitView sv)
        {
            if (sv.LeftArea.IsNull())
            {
                return;
            }
            if (sv.DisplayMode == SplitViewDisplayMode.CompactOverlay || sv.DisplayMode == SplitViewDisplayMode.CompactInline)
            {
                sv.LeftArea.Visibility = Visibility.Visible;
            }
            else
            {
                if (sv.IsPaneOpen)
                {
                    sv.LeftArea.Visibility = Visibility.Visible;
                }
                else
                {
                    sv.LeftArea.Visibility = Visibility.Collapsed;
                }
            }

            if (sv.PanePlacement == SplitViewPanePlacement.Left || sv.PanePlacement == SplitViewPanePlacement.Right)
            {
                sv.LeftArea.Height = double.NaN;
                if (sv.IsPaneOpen)
                {
                    if (sv.DisplayMode == SplitViewDisplayMode.Inline || sv.DisplayMode == SplitViewDisplayMode.Overlay)
                    {
                        sv.LeftArea.Width = sv.OpenPaneLength;
                    }
                }
                else
                {
                    if (sv.DisplayMode == SplitViewDisplayMode.CompactInline || sv.DisplayMode == SplitViewDisplayMode.CompactOverlay)
                    {
                        sv.LeftArea.Width = sv.CompactPaneLength;
                    }
                    else
                    {
                        sv.LeftArea.Width = sv.OpenPaneLength;
                    }
                }
            }
            else
            {
                sv.LeftArea.Width = double.NaN;
                if (sv.IsPaneOpen)
                {
                    if (sv.DisplayMode == SplitViewDisplayMode.Inline || sv.DisplayMode == SplitViewDisplayMode.Overlay)
                    {
                        sv.LeftArea.Height = sv.OpenPaneLength;
                    }
                }
                else
                {
                    if (sv.DisplayMode == SplitViewDisplayMode.CompactInline || sv.DisplayMode == SplitViewDisplayMode.CompactOverlay)
                    {
                        sv.LeftArea.Height = sv.CompactPaneLength;
                    }
                    else
                    {
                        sv.LeftArea.Height = sv.OpenPaneLength;
                    }
                }
            }
        }
示例#8
0
        private static void InlineOrOverlay(AySplitView sv, bool isOpenValue)
        {
            if (isOpenValue) //从隐藏到显示
            {
                if (sv.LeftArea.IsNull())
                {
                    return;
                }
                {
                    Thickness thickOld = new Thickness(sv.LeftArea.Width * (-1), 0, 0, 0);
                    if (double.IsNaN(sv.OpenPaneLength))
                    {
                        thickOld = new Thickness(sv.cc.RenderSize.Width * (-1), 0, 0, 0);
                    }
                    sv.LeftArea.Margin     = thickOld;
                    sv.LeftArea.Visibility = Visibility.Visible;
                    Thickness thicnew = new Thickness(0, 0, 0, 0);
                    ThicknessAnimationUsingKeyFrames taShow = new ThicknessAnimationUsingKeyFrames();
                    taShow.Duration     = new Duration(TimeSpan.FromMilliseconds(sv.OpenMillisecondTime));
                    taShow.FillBehavior = FillBehavior.Stop;
                    taShow.Completed   += (sender, ev) =>
                    {
                        sv.LeftArea.Margin = thicnew;
                        taShow             = null;

                        #region 触发客户端定义的事件
                        sv.OpenPaneCompletedChanged();
                        #endregion
                    };
                    EasingThicknessKeyFrame taFrame = new EasingThicknessKeyFrame(thicnew, KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(sv.OpenMillisecondTime)));
                    taShow.KeyFrames.Add(taFrame);
                    sv.LeftArea.BeginAnimation(Grid.MarginProperty, taShow);
                }
                //if (sv.DisplayMode == SplitViewDisplayMode.Inline)
                //{
                //    {
                //        Thickness thickOld = new Thickness(0 , 0, 0, 0);
                //        sv.ContentArea.Margin = thickOld;
                //        Thickness thicnew = new Thickness(sv.LeftArea.Width, 0, 0, 0);
                //        if (double.IsNaN(sv.OpenPaneLength))
                //        {
                //            thicnew = new Thickness(sv.cc.RenderSize.Width, 0, 0, 0);
                //        }
                //        sv.ContentArea.Margin = thicnew;
                //        //ThicknessAnimationUsingKeyFrames taShow = new ThicknessAnimationUsingKeyFrames();
                //        //taShow.Duration = new Duration(TimeSpan.FromMilliseconds(sv.OpenMillisecondTime));
                //        //taShow.FillBehavior = FillBehavior.Stop;
                //        //taShow.Completed += (sender, ev) =>
                //        //{
                //        //    sv.ContentArea.Margin = thicnew;
                //        //    taShow = null;
                //        //};
                //        //EasingThicknessKeyFrame taFrame = new EasingThicknessKeyFrame(thicnew, KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(sv.OpenMillisecondTime)));
                //        //taShow.KeyFrames.Add(taFrame);
                //        //sv.LeftArea.BeginAnimation(Grid.MarginProperty, taShow);
                //    }
                //}
            }
            else //显示到隐藏
            {
                Thickness thickOld = new Thickness(0, 0, 0, 0);
                sv.LeftArea.Margin = thickOld;
                Thickness thicnew = new Thickness(sv.cc.RenderSize.Width * (-1), 0, 0, 0);
                if (!double.IsNaN(sv.OpenPaneLength))
                {
                    thicnew = new Thickness(sv.OpenPaneLength * (-1), 0, 0, 0);
                }

                ThicknessAnimationUsingKeyFrames taShow = new ThicknessAnimationUsingKeyFrames();
                taShow.Duration     = new Duration(TimeSpan.FromMilliseconds(sv.OpenMillisecondTime));
                taShow.FillBehavior = FillBehavior.Stop;
                taShow.Completed   += (sender, ev) =>
                {
                    sv.LeftArea.Margin     = thicnew;
                    sv.LeftArea.Visibility = Visibility.Collapsed;
                    taShow = null;
                    #region 触发客户端定义的事件
                    sv.ClosePaneCompletedChanged();
                    #endregion
                };

                EasingThicknessKeyFrame taFrame = new EasingThicknessKeyFrame(thicnew, KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(sv.OpenMillisecondTime)));
                taShow.KeyFrames.Add(taFrame);
                sv.LeftArea.BeginAnimation(Grid.MarginProperty, taShow);
            }
        }
示例#9
0
        private static void InlineOrOverlayBottom(AySplitView sv, bool isOpenValue)
        {
            if (sv.LeftArea.IsNull())
            {
                return;
            }
            if (isOpenValue) //从隐藏到显示
            {
                Thickness thickOld = new Thickness(0, 0, 0, sv.LeftArea.Height * (-1));

                if (double.IsNaN(sv.OpenPaneLength))
                {
                    thickOld = new Thickness(0, 0, 0, sv.cc.RenderSize.Height * (-1));
                }
                sv.LeftArea.Margin     = thickOld;
                sv.LeftArea.Visibility = Visibility.Visible;
                Thickness thicnew = new Thickness(0, 0, 0, 0);
                ThicknessAnimationUsingKeyFrames taShow = new ThicknessAnimationUsingKeyFrames();
                taShow.Duration     = new Duration(TimeSpan.FromMilliseconds(sv.OpenMillisecondTime));
                taShow.FillBehavior = FillBehavior.Stop;
                taShow.Completed   += (sender, ev) =>
                {
                    sv.LeftArea.Margin = thicnew;
                    taShow             = null;
                    #region 触发客户端定义的事件
                    sv.OpenPaneCompletedChanged();
                    #endregion
                };

                EasingThicknessKeyFrame taFrame = new EasingThicknessKeyFrame(thicnew, KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(sv.OpenMillisecondTime)));
                taShow.KeyFrames.Add(taFrame);
                sv.LeftArea.BeginAnimation(Grid.MarginProperty, taShow);
            }
            else //显示到隐藏
            {
                Thickness thickOld = new Thickness(0, 0, 0, 0);
                sv.LeftArea.Margin = thickOld;
                Thickness thicnew = new Thickness(0, 0, 0, sv.cc.RenderSize.Height * (-1));
                if (!double.IsNaN(sv.OpenPaneLength))
                {
                    thicnew = new Thickness(0, 0, 0, sv.OpenPaneLength * (-1));
                }

                ThicknessAnimationUsingKeyFrames taShow = new ThicknessAnimationUsingKeyFrames();
                taShow.Duration     = new Duration(TimeSpan.FromMilliseconds(sv.OpenMillisecondTime));
                taShow.FillBehavior = FillBehavior.Stop;
                taShow.Completed   += (sender, ev) =>
                {
                    sv.LeftArea.Margin     = thicnew;
                    sv.LeftArea.Visibility = Visibility.Collapsed;
                    taShow = null;
                    #region 触发客户端定义的事件 ====================www.ayjs.net       杨洋    wpfui.com        ayui      ay  aaronyang=======盗窃代码请注意=========
                    sv.ClosePaneCompletedChanged();
                    #endregion
                };

                EasingThicknessKeyFrame taFrame = new EasingThicknessKeyFrame(thicnew, KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(sv.OpenMillisecondTime)));
                taShow.KeyFrames.Add(taFrame);
                sv.LeftArea.BeginAnimation(Grid.MarginProperty, taShow);
            }
        }
 public static void SetToggleMenu(DependencyObject obj, AySplitView value)
 {
     obj.SetValue(ToggleMenuProperty, value);
 }