Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6670447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:16:13+00:00 2026-05-26T03:16:13+00:00

I m new in WPF, i am developing a navigation application of WPF, <NavigationWindow

  • 0

I m new in WPF,
i am developing a navigation application of WPF,

<NavigationWindow x:Class="KioskTraffic.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="768" Width="1024" Source="Home.xaml"
    WindowState="Maximized" ResizeMode="NoResize" ShowsNavigationUI="False" WindowStyle="None" Cursor="Arrow" Closing="NavigationWindow_Closing"></NavigationWindow>

and i have some page which display in this navigarionwindow like

<Page x:Class="KioskTraffic.Page1"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      mc:Ignorable="d" 
      Height="768" Width="1024"
      Title="Page1">

How can i know which page is running currently under NavigationWindow.xaml.cs file?

I have a timer in this navigation window that want to check if current page is home.xaml then i don’t want to start that timer.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:16:13+00:00Added an answer on May 26, 2026 at 3:16 am

    You can get current running page in code behind using CurrentSource property of navigation window. As per your requirements, it’s done using NavigationService.Navigate() method like below :

    NavWindow.xaml :

    <NavigationWindow x:Class="WPFTest.MyNavWindow" 
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="MainWindow" Height="768" Width="1024" Source="ShopList.xaml" Grid.Row="1" 
            WindowState="Maximized" ResizeMode="NoResize" ShowsNavigationUI="True" WindowStyle="SingleBorderWindow" Cursor="Arrow" Navigated="NavigationWindow_Navigated">
    </NavigationWindow>
    

    NavWindow.xaml.cs :

    namespace WPFTest
    {
        public partial class MyNavWindow : NavigationWindow
        {
            public MyNavWindow()
            {
                InitializeComponent();
            }
    
            private void NavigationWindow_Navigated(object sender, NavigationEventArgs e)
            {
                MessageBox.Show(((NavigationWindow)this).CurrentSource.ToString());
            }
        }
    }
    

    ShopList.xaml :

    <Page x:Class="WPFTest.ShopList"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="ShopList">
    <Grid>
        <Label Height="28" Margin="81,12,99,0" Name="label1" VerticalAlignment="Top" FontSize="16" FontWeight="Bold">Shop List</Label>
        <Button Name="btnNext" Content="Go to Product list" Width="150" Height="30" Margin="0,50,0,0" Click="btnNext_Click"></Button>
    </Grid>
    

    ShopList.xaml.cs :

    namespace WPFTest
    {
        public partial class ShopList : Page
        {
            public ShopList()
            {
                InitializeComponent();
            }
    
            private void btnNext_Click(object sender, RoutedEventArgs e)
            {
                NavigationService.Navigate(new System.Uri("ProductList.xaml", UriKind.Relative));
            }
        }
    }
    

    ProductList.xaml :

    <Page x:Class="WPFTest.ProductList"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="ProductList">
        <Grid>
            <Label Height="28" Margin="81,12,99,0" Name="label1" VerticalAlignment="Top" FontSize="16" FontWeight="Bold">Product List</Label>
        </Grid>
    </Page>
    

    It’s working fine for me. Hope this solve your problem. Please feel free to ask if it not solve.

    UPDATE :

    If you want to navigate page using class name instead of Uri then you can get current source like :

    MessageBox.Show(((NavigationWindow)this).NavigationService.Content.GetType().Name.ToString() + ".xaml");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a newbie to WPF and I'm developing a brand new windows desktop application
I am currently developing a new WPF application and have the majority of my
I created new WPF Application witn two windows. MainWindow.xaml Window1.xaml Added one button in
While designing a new WPF application I noticed exceptions not being thrown during data
I need help on developing a WPF UI. I'm new to WPF. So far
I am about to create a new developer PC image for developing WPF applications
I am developing a WPF windows application and am getting into a trouble running
I am developing a game with WPF technology. I want to add new Features
i'm developing an application (wpf) that have 3 windows. in the main window user
I'm developing a WPF application, and I have created a custom usercontrol because I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.