void ScrollStackPanel_Loaded(object sender, RoutedEventArgs e) { if (PageNextButton != null) { ToolTipService.SetToolTip(PageNextButton, ResourcesUtil.GetResourceValue(ResourcesUtil.WIDGETBAR_NAVIGATE_NEXT)); PageNextButton.State = (this.Orientation == Orientation.Horizontal) ? ToggleButtonState.STATE_ROTATE_90 : ToggleButtonState.STATE_ORIGIN; } if (PageBackButton != null) { ToolTipService.SetToolTip(PageBackButton, ResourcesUtil.GetResourceValue(ResourcesUtil.WIDGETBAR_NAVIGATE_BACK)); PageBackButton.State = (this.Orientation == Orientation.Horizontal) ? ToggleButtonState.STATE_ROTATE90 : ToggleButtonState.STATE_ROTATE180; } }
protected virtual void UndockMe() { this.currentTop = InitialTop; this.currentLeft = InitialLeft; Canvas.SetTop(this, InitialTop); Canvas.SetLeft(this, InitialLeft); Canvas.SetZIndex(this, CurrentZIndex++); RadioFloat.IsChecked = true; this.IsInUpperPage = InitialTop < CanvasHeight / 2.0; RaiseStateChangeEvent(true); ControlGrip.Height = BarHeight - 10; TaskbarBack.Visibility = Visibility.Visible; DockStation.Visibility = Visibility.Collapsed; ToolTipService.SetToolTip(ControlGrip, ResourcesUtil.GetResourceValue(ResourcesUtil.TASKBAR_TOOLTIP_FLOAT)); }
protected virtual void DockMe() { this.currentLeft = 0; this.currentTop = (DockPosition == DockPosition.BOTTOM) ? CanvasHeight - DockHeight : 0; Canvas.SetTop(this, this.currentTop); Canvas.SetLeft(this, this.currentLeft); Canvas.SetZIndex(this, 1); RadioDockTop.IsChecked = DockPosition == DockPosition.TOP; RadioDockBottom.IsChecked = DockPosition == DockPosition.BOTTOM; this.IsInUpperPage = DockPosition == DockPosition.TOP; RaiseStateChangeEvent(true); ControlGrip.Height = DockHeight; DockStation.Fill = this.Background; DockStation.Margin = new Thickness(0, 0, 0, 0); DockStation.Visibility = Visibility.Visible; TaskbarBack.Visibility = Visibility.Collapsed; ToolTipService.SetToolTip(ControlGrip, ResourcesUtil.GetResourceValue(ResourcesUtil.TASKBAR_TOOLTIP_DOCK)); }
public override void OnApplyTemplate() { base.OnApplyTemplate(); this.CreateStoryboard(); this.currentTop = InitialTop; this.currentLeft = InitialLeft; TaskbarBack = this.GetTemplateChild(_TASKBAR_BACK) as Shape; DockStation = this.GetTemplateChild(_DOCK_STATION) as Shape; TemplateGrid = this.GetTemplateChild(_TEMPLATE_GRID) as Grid; if (TemplateGrid != null && DockStation != null && TaskbarBack != null && ControlGrip != null) { DockStation.MouseLeftButtonDown += (o, e) => { this.Focus(); }; Canvas StateMenuCanvas = new Canvas() { Margin = new Thickness(0, 0, 0, 0) }; TemplateGrid.Children.Add(StateMenuCanvas); StateMenuPanel = new Border() { MaxWidth = 132, MaxHeight = 72, Visibility = Visibility.Collapsed, BorderThickness = new Thickness(2), CornerRadius = new CornerRadius(4) }; StateMenuPanel.BorderBrush = new SolidColorBrush(Color.FromArgb(0xFF, 0x66, 0x66, 0x99)); StateMenuPanel.Background = new SolidColorBrush(Colors.White); StateMenuPanel.MouseLeave += new MouseEventHandler(OnMouseLeaveMenuPanel); StateMenuCanvas.Children.Add(StateMenuPanel); StateMenuStack = new StackPanel() { Margin = new Thickness(4, 4, 4, 4), Orientation = Orientation.Vertical, Background = new SolidColorBrush(Colors.Transparent) }; StateMenuPanel.Child = StateMenuStack; RadioFloat = new RadioButton() { Margin = new Thickness(1, 1, 1, 1), GroupName = "RadioTaskbarState", Content = ResourcesUtil.GetResourceValue(ResourcesUtil.TASKBAR_FLOATING), Tag = DockPosition.NONE }; RadioDockTop = new RadioButton() { Margin = new Thickness(1, 1, 1, 1), GroupName = "RadioTaskbarState", Content = ResourcesUtil.GetResourceValue(ResourcesUtil.TASKBAR_DOCK_TOP), Tag = DockPosition.TOP }; RadioDockBottom = new RadioButton() { Margin = new Thickness(1, 1, 1, 1), GroupName = "RadioTaskbarState", Content = ResourcesUtil.GetResourceValue(ResourcesUtil.TASKBAR_DOCK_BOTTOM), Tag = DockPosition.BOTTOM }; RadioFloat.Click += new RoutedEventHandler(OnStateRadioClicked); RadioDockTop.Click += new RoutedEventHandler(OnStateRadioClicked); RadioDockBottom.Click += new RoutedEventHandler(OnStateRadioClicked); StateMenuStack.Children.Add(RadioFloat); StateMenuStack.Children.Add(RadioDockTop); StateMenuStack.Children.Add(RadioDockBottom); } else if (TemplateGrid != null && ControlGrip == null) { TemplateGrid.MouseLeftButtonDown += new MouseButtonEventHandler(OnMouseLeftButtonDownControl); } if (this.Effect != null) { if (DockStation != null) { DockStation.Effect = this.Effect; } if (TaskbarBack != null) { TaskbarBack.Effect = this.Effect; } this.Effect = null; } // After Canvas is loaded if (this.CanvasWidth > 0.0) { this.ResetTaskbarState(); } this.isTemplateApplied = true; }