public BackstageViewItem() { this.OverrideStyleKey <BackstageViewItem>(); ContentHost.SetBinding(System.Windows.Controls.ContentPresenter.ContentTemplateProperty, new Binding { Path = new PropertyPath(ContentTemplateProperty), Source = this }); AddLogicalChild(ContentHost); }
public TabViewItem() { this.OverrideStyleKey <TabViewItem>(); ContentHost.SetBinding(ContentPresenter.ContentTemplateProperty, new Binding { Path = new PropertyPath(ContentTemplateProperty), Source = this }); ContentHost.SetBinding(ContentPresenter.ContentTemplateSelectorProperty, new Binding { Path = new PropertyPath(ContentTemplateSelectorProperty), Source = this }); ContentHost.SetBinding(ContentPresenter.ContentStringFormatProperty, new Binding { Path = new PropertyPath(ContentStringFormatProperty), Source = this }); SelectCommand = new RelayCommand(OnSelectCommandExecute); UpdateActualCloseCommandParameter(); }
public void SwitchScreen(ScreenState screenState) { if (screenState == CurrentState) { return; } Brush highlight = Brushes.DarkCyan; Brush shadow = Brushes.Gray; double timespanSeconds = .25; switch (screenState) { case ScreenState.Installer: InstallerButton.Background = highlight; LauncherButton.Background = shadow; CurrentPage = InstallerScreen; LauncherScreen.IsEnabled = false; WindowContentLeft.Content = InstallerScreen; InstallerScreen.IsEnabled = true; ScreenAnimation = new ThicknessAnimation( new Thickness(0, 0, 0, 0), TimeSpan.FromSeconds(timespanSeconds)); break; case ScreenState.Launcher: InstallerButton.Background = shadow; LauncherButton.Background = highlight; CurrentPage = LauncherScreen; InstallerScreen.IsEnabled = false; WindowContentRight.Content = LauncherScreen; LauncherScreen.IsEnabled = true; ScreenAnimation = new ThicknessAnimation( new Thickness(-ScreenExpectedWidth / 2, 0, 0, 0), TimeSpan.FromSeconds(timespanSeconds)); break; } AnimationRunning = true; ScreenAnimation.Completed += ScreenAnimation_Completed; ScreenAnimation.FillBehavior = FillBehavior.Stop; ContentHost.BeginAnimation(MarginProperty, ScreenAnimation); CurrentState = screenState; }