public override void OnApplyTemplate() { base.OnApplyTemplate(); _pageContent = GetTemplateChild(ElementPageContent) as ContentControl; if (_pageContent == null) { throw new MissingMemberException("Expected to find template member: " + ElementPageContent); } _menuContent = GetTemplateChild(MenuContent) as Panel; if (_menuContent == null) { throw new MissingMemberException("Expected to find template member: " + MenuContent); } AddChildren(); // select the first child if (Children.Count > 0) { NavigationButton button = Children[0] as NavigationButton; if (button != null) { button.IsSelected = true; SelectionChanged(Children[0] as NavigationButton); } } }
public void SelectionChanged(NavigationButton button) { // ignore the case where the selection changed to be "not selected" or is already selected if (button.IsSelected == false || button == _selectedButton) { return; } if (_selectedButton != null) { _selectedButton.IsSelected = false; } _selectedButton = button; _pageContent.Content = button.Content; }
public void SelectionChanged(NavigationButton button) { // ignore the case where the selection changed to be "not selected" or is already selected if (button.IsSelected == false || button == _selectedButton) return; if (_selectedButton != null) { _selectedButton.IsSelected = false; } _selectedButton = button; _pageContent.Content = button.Content; }