using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; namespace TutorialNavbarXap { public partial class Page : UserControl { Nav1Page m_nav1Page = new Nav1Page(); Nav2Page m_nav2Page = new Nav2Page(); Nav3Page m_nav3Page = new Nav3Page(); public Page() { InitializeComponent(); Loaded += new RoutedEventHandler(PageLoaded); } void PageLoaded(object sender, RoutedEventArgs e) { // Remove all content add then add the Nav1Page RemoveAll(); ContentCanvas.Children.Add(m_nav1Page); // Highlight Nav1 HighlightNone(); Nav1Highlight.Opacity = 100.0; } void RemoveAll() { ContentCanvas.Children.Remove(m_nav1Page); ContentCanvas.Children.Remove(m_nav2Page); ContentCanvas.Children.Remove(m_nav3Page); } private void OnNav1Click(object sender, MouseButtonEventArgs e) { RemoveAll(); ContentCanvas.Children.Add(m_nav1Page); } private void OnNav2Click(object sender, MouseButtonEventArgs e) { RemoveAll(); ContentCanvas.Children.Add(m_nav2Page); } private void OnNav3Click(object sender, MouseButtonEventArgs e) { RemoveAll(); ContentCanvas.Children.Add(m_nav3Page); } private void HighlightNone() { Nav1Highlight.Opacity = 0.0; Nav2Highlight.Opacity = 0.0; Nav3Highlight.Opacity = 0.0; } private void OnNav1Enter(object sender, MouseEventArgs e) { HighlightNone(); Nav1Highlight.Opacity = 100.0; MoveToNav1.Begin(); } private void OnNav2Enter(object sender, MouseEventArgs e) { HighlightNone(); Nav2Highlight.Opacity = 100.0; MoveToNav2.Begin(); } private void OnNav3Enter(object sender, MouseEventArgs e) { HighlightNone(); Nav3Highlight.Opacity = 100.0; MoveToNav3.Begin(); } } }
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)