Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I programmatically change the Title in a wpf window?

Tags:

How do I programmatically change the Title in a wpf window?

<Window x:Class="Temp.MainWindow"  ...  Title="Contacts"> 

Change the Title from "Contacts" to "Something new" when the program finds new information as it starts.

like image 769
ttom Avatar asked Feb 10 '15 16:02

ttom


People also ask

How do I change the project name in WPF?

double-click project's properties, choose the Application tab, then change what you need: Assembly name. Default namespace. click Assembly information and change Title and Product.

How do I change a WPF window to a page?

Answers. You can either just host the Page in a Frame. Alternatively, just make a new Window, and put the same xaml content in the Window class. Migrate any code in the code behind to your new Window class.

What is window in XAML?

Advertisements. It is the root window of an XAML application which provides minimize/maximize option, Title bar, border, and close button. It also provides the ability to create, configure, show, and manage the lifetime of windows and dialog boxes.


2 Answers

To change it you can simply alter the Title property from your code:

this.Title = "Something new"; 
like image 108
Gaessaki Avatar answered Sep 19 '22 09:09

Gaessaki


Bind it to a property

Title="{Binding WindowTitle}" 
like image 45
Tim Rutter Avatar answered Sep 21 '22 09:09

Tim Rutter