29

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.

ttom
  • 985
  • 3
  • 12
  • 21
  • You should use [binding](https://msdn.microsoft.com/en-us/library/ms752347%28v=vs.110%29.aspx). Bind the title property of window to a property of your DataContext. – Alberto Solano Feb 10 '15 at 16:47

2 Answers2

58

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

this.Title = "Something new";
Gaessaki
  • 836
  • 1
  • 8
  • 16
29

Bind it to a property

Title="{Binding WindowTitle}"
Tim Rutter
  • 4,549
  • 3
  • 23
  • 47