public override void OnApplyTemplate() { _panel = this.GetTemplateChild("PART_Panel") as Panel; _scrollViewer = this.GetTemplateChild("PART_ScrollViewer") as AnimatableScrollViewer; _leftButton = this.GetTemplateChild("PART_LeftButton") as NavigationButton; if (_leftButton != null) { _leftButton.AddHandler(NavigationButton.ClickEvent, new RoutedEventHandler(this.OnLeftButtonClicked)); } _rightButton = this.GetTemplateChild("PART_RightButton") as NavigationButton; if (_rightButton != null) { _rightButton.AddHandler(NavigationButton.ClickEvent, new RoutedEventHandler(this.OnRightButtonClicked)); } _breadcrumbBar = this.GetTemplateChild("PART_BreadcrumbBar") as BreadcrumbBulletBar; if (_breadcrumbBar != null) { _breadcrumbBar.SelectedIndexChanged += this.OnBreadcrumbBarSelectedIndexChanged; } }
private static void OnVerticalChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { AnimatableScrollViewer viewer = d as AnimatableScrollViewer; viewer.ScrollToVerticalOffset((double)e.NewValue); }