ChildWindow.Title Property


Gets or sets the title of the ChildWindow.

Namespace:  System.Windows.Controls
Assembly:  System.Windows.Controls (in System.Windows.Controls.dll)

public Object Title { get; set; }
<sdk:ChildWindow Title="string"/>
<sdk:ChildWindow Title="objectReference"/>

XAML Values


A StaticResource reference to an Object.

Property Value

Type: System.Object
The title of the child window. The default is null.

Dependency property identifier field: TitleProperty

You can set the Title to be any object. This lets you create complex titles with text, graphics, and animations. If the object does not have a visual representation, the string representation of the object returned by the ToString method will be shown in the title bar.

The following example demonstrates how to set a simple text Title in XAML. This example is part of a larger example available in the ChildWindow class overview.

<!-- NOTE: 
  By convention, the sdk prefix indicates a URI-based XAML namespace declaration 
  for Silverlight SDK client libraries. This namespace declaration is valid for 
  Silverlight 4 only. In Silverlight 3, you must use individual XAML namespace 
  declarations for each CLR assembly and namespace combination outside the scope 
  of the default Silverlight XAML namespace. For more information, see the help 
  topic "Prefixes and Mappings for Silverlight Libraries". 
<sdk:ChildWindow x:Class="ChildWindowLogin.LoginWindow"
           Width="300" Height="200" 
           Title="Login Window"

The following example demonstrates how to set a complex Title in code. The title consists of a StackPanel that contains an image and text.

Run this sample

<UserControl x:Class="ChildWindowTitle.MainPage"
    Width="400" Height="300">

    <Grid x:Name="LayoutRoot" Background="White">
        <StackPanel Margin="10">
            <TextBlock Text="Enter a title for the child window:" />
            <TextBox x:Name="titleText" />
            <Button Content="Show Child Window" Click="Button_Click"
                    Height="23" Width="125" HorizontalAlignment="Left"

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace ChildWindowTitle
    public partial class MainPage : UserControl
        public MainPage()

        private void Button_Click(object sender, RoutedEventArgs e)
            ChildWindow childWindow = new ChildWindow();
            childWindow.Title = GetTitle(titleText.Text);
            childWindow.Content = "Child Window Content.";

        private StackPanel GetTitle(string title)
            // Logo image.
            ImageBrush logoBrush = new ImageBrush();
            logoBrush.ImageSource = new BitmapImage(new Uri("/Silverlight.jpg", UriKind.Relative));

            // Container for logo image.
            Ellipse logo = new Ellipse();
            logo.Height = 24;
            logo.Width = 24;
            logo.Fill = logoBrush;

            // Title text.
            TextBlock titletext = new TextBlock();
            titletext.Text = title;
            titletext.VerticalAlignment = VerticalAlignment.Bottom;

            // Container for logo and text.
            StackPanel titlePanel = new StackPanel();
            titlePanel.Orientation = Orientation.Horizontal;

            return titlePanel;


Supported in: 5, 4, 3

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions