예제 #1
0
        private void HideSidebar()
        {
            LayoutDockPanel.IsEnabled = true;
            DoubleAnimation animation = new DoubleAnimation(0, TimeSpan.FromSeconds(0.3));

            animation.Completed += (sender, e) =>
            {
                SideBarDockPanelContent.Children.Clear();
            };

            SideBarDockPanel.BeginAnimation(Rectangle.WidthProperty, animation);
        }
예제 #2
0
        /// <summary>
        /// 显示侧边框。
        /// </summary>
        /// <param name="control">显示的元素。</param>
        /// <param name="width">长度。</param>
        public void ShowSidebar(FrameworkElement control, double width, string title)
        {
            SideBarTitleTextBlock.Text = title;

            LayoutDockPanel.IsEnabled = false;
            SideBarDockPanelContent.Children.Add(control);
            SideBarDockPanel.Width      = 0;
            SideBarDockPanel.Visibility = Visibility.Visible;

            DoubleAnimation animation = new DoubleAnimation(width, TimeSpan.FromSeconds(0.3));

            SideBarDockPanel.BeginAnimation(Rectangle.WidthProperty, animation);

            if (!SideBars.ContainsValue(control))
            {
                SideBars.Add(ContentQueue[ContentQueue.Count - 1], control);
            }
            if (!SideBarSettings.ContainsKey(control))
            {
                SideBarSettings.Add(control, new System.Tuple <double, string>(width, title));
            }
        }