public void HideCharacterSheet() { CharacterUserControl control = (CharacterUserControl)RootCanvas.Children.Cast <FrameworkElement>().FirstOrDefault(o => o.Name == "CharacterSheet"); if (control != null) { control.Visibility = Visibility.Hidden; } isCharacterSheetVisible = false; }
public void ShowCharacterSheet() { HideMainMenu(); HideBoardGame(); CharacterUserControl control = (CharacterUserControl)RootCanvas.Children.Cast <FrameworkElement>().FirstOrDefault(o => o.Name == "CharacterSheet"); if (control == null) { control = new CharacterUserControl(); control.Name = "CharacterSheet"; control.HorizontalAlignment = HorizontalAlignment.Stretch; control.VerticalAlignment = VerticalAlignment.Stretch; control.Width = RootCanvas.ActualWidth; control.Height = RootCanvas.ActualHeight; RootCanvas.Children.Add(control); Canvas.SetLeft(control, 0); Canvas.SetTop(control, 0); } control.Visibility = Visibility.Visible; isCharacterSheetVisible = true; }