How to get the Content of the Title of the Window in WPF

DonBaechtel-7903 196 Reputation points
2023-04-08T11:29:31.6+00:00

How do you get the Content of the Title object of a XAML Window as a string in C# ? Although it appears on the screen, it does not appear to be a Propery of the MainWindow.

<Window x:Class="MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:Cinetique_GUI"
        xmlns:sys="clr-namespace:System;assembly=mscorlib"
        mc:Ignorable="d"
        Title="GUI  Version 0.11 " Height="1080" Width="1920" WindowState="Maximized" >
Windows for business | Windows Client for IT Pros | User experience | Other
Developer technologies | Visual Studio | Other
Developer technologies | XAML
Developer technologies | C#
0 comments No comments
{count} votes

Accepted answer
  1. Castorix31 90,686 Reputation points
    2023-04-08T11:58:05.2366667+00:00

    Title is a property : https://learn.microsoft.com/en-us/dotnet/api/system.windows.window.title?view=windowsdesktop-7.0 In a Button_Click : string sTitle = this.Title;

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.