Exemple #1
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);
     }
 }
Exemple #2
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);
            }
        }
Exemple #3
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);
            }
        }