---
title: "How to add an Image in the title bar?"  
description: "How to add an Image in the title bar?"  
author: "Anonymous User"  
published: 2014-01-29  
updated: 2014-01-29  
canonical: https://www.mindstick.com/forum/1907/how-to-add-an-image-in-the-title-bar  
category: "c#"  
tags: ["c#"]  
reading_time: 2 minutes  

---

# How to add an Image in the title bar?

The [icon](https://www.mindstick.com/articles/13090/icon-the-identity-of-your-brand) in the [title](https://www.mindstick.com/articles/12860/how-to-get-financing-for-salvage-title-cars) bar is too small, so I want to [add](https://www.mindstick.com/forum/12983/add-address-in-textbox-when-page-is-load-and-if-i-search-address-in-textbox-show-in-map-by-javascript) [Image](https://www.mindstick.com/articles/23551/an-investigate-distinctive-seafood-restaurant-for-your-image-stamp-character) [instead of](https://www.mindstick.com/articles/330/triggers-in-sql-server) Icon.

## Replies

### Reply by Pravesh Singh

Hi Jacob,\

If you don't like to use the icon, the single way to do this is to make a custom title bar, I think...

You can use this code: This is the XAML code:

```
<Window x:Class="WpfApplication1.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"Title="MainWindow" Height="350"
Width="525" WindowStyle="None"><Grid>    <Border BorderBrush="#FF00860C" BorderThickness="3"
Name="border1" Margin="0,30,0,0"></Border>    <Rectangle Name="rectangle1" Stroke="#FF2446FF"
StrokeThickness="3" Height="30" VerticalAlignment="Top" MouseDown="rectangle1_MouseDown">       
<Rectangle.Fill>           
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">               
<GradientStop Color="White" Offset="0.013" />               
<GradientStop Color="White" Offset="1" />               
<GradientStop Color="#FF7CAEFF" Offset="0.477"/>           
</LinearGradientBrush>       
</Rectangle.Fill>    </Rectangle>    <Button
Content="X" Height="24" HorizontalAlignment="Right" Margin="0,3,3,0" Name="button1" VerticalAlignment="Top" Width="23"
Click="button1_Click" />    <Button Content="□" Height="24" HorizontalAlignment="Right" Margin="0,3,26,0"
Name="button2" VerticalAlignment="Top" Width="23" Click="button2_Click" />    <Button Content="__" Height="24" HorizontalAlignment="Right" Margin="0,3,49,0" Name="button3"
VerticalAlignment="Top" Width="23" Click="button3_Click" />    <TextBlock Height="23" HorizontalAlignment="Left" Margin="102,4,0,0" Name="textBlock1" Text="Custom
Title bar" VerticalAlignment="Top" FontSize="18" MouseDown="rectangle1_MouseDown"/>    <Image Height="22" HorizontalAlignment="Left" Margin="8,4,0,0" Name="image1" Stretch="Fill"
VerticalAlignment="Top" Width="26" /></Grid>
```

## And this is the C# code:

```
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace WpfApplication1
{
    ///
<summary>
    /// Interaction
 logic for MainWindow.xaml
    ///
</summary>
    public partial
 class MainWindow : Window
    {
        public
 MainWindow()
        {

InitializeComponent();
        }
        private void
 button1_Click(object sender, RoutedEventArgs e)
        {

this.Close();
        }
        private void
 button2_Click(object sender, RoutedEventArgs e)
        {
if (this.WindowState == WindowState.Maximized)

this.WindowState = WindowState.Normal;
            else

this.WindowState = WindowState.Maximized;
        }
        private void
 button3_Click(object sender, RoutedEventArgs e)
        {

this.WindowState = WindowState.Minimized;
        }
        private void
 rectangle1_MouseDown(object sender, MouseButtonEventArgs e)
        {

DragMove();
        }
    }
}
```

\

\

\


---

Original Source: https://www.mindstick.com/forum/1907/how-to-add-an-image-in-the-title-bar

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
