S.John Hawkins

I have a listbox in a page..eg HomePage. It has a title as Home.. when i click a listbox item called Employee the Employee screen is opened in a seperate frame in that same homepage, while opening the employee screen i want the window title to be changed as Employee replacing the old title..

Waiting for the answers...

Thanks,

S.John Hawkins.



Re: Windows Presentation Foundation (WPF) How to Set the Window Title to a Page when the form name in a frame changes dyanamically..

Michael.Weinhardt - MSFT

As it looks like you've discovered, Page.WindowTitle does not set the title of a Window if a page is hosted in a frame in a window.

I'm not sure if I understand 100% what you're saying, but you can set the title of the main application window. The main application window is most often the window that was first loaded in a WPF application eg:

<!-- MainWindow will be the main app window -->

<Application ... StartupUri="MainWindow.xaml" />

or

<!-- A NavigationWindow will be the main app window -->

<Application ... StartupUri="HomePage.xaml" />

In this case, you can do the following from your page:

<Page

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

x:Class="SDKSample.PageInFrame"

Loaded="page_Loaded" >

...

</Page>

using System;

using System.Windows;

using System.Windows.Controls;

namespace SDKSample

{

public partial class PageInFrame : Page

{

public PageInFrame()

{

InitializeComponent();

}

void page_Loaded(object sender, RoutedEventArgs e)

{

App.Current.MainWindow.Title = "Title of your choice!";

}

}

}





Re: Windows Presentation Foundation (WPF) How to Set the Window Title to a Page when the form name in a frame changes dyanamically..

S.John Hawkins

Hi Micheal,

Thank u so much for ur post.. i was expecting the same code which u have posted..

Now it's working fine..

Thank u,

S.John Hawkins.