Show window icon in title bar using MahApps.Metro?

I started using MahApps.Metro only yesterday, and I cannot figure out how to get the application icon so that it appears as a window icon in a window (or, better, that's it). Here is included in the example window icon, but I can’t get it. When i use

ShowIconOnTitleBar="True"

he does not do anything. What am I doing wrong?

+4
source share
1 answer

You need to set the property Iconlike this example (taken from the Mahapps demo application):

<Controls:MetroWindow x:Class="MetroDemo.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
Title="MahApps.Metro - Demo Application"
        Width="960" Height="600"
        Icon="mahapps.metro.logo2.ico"
        ShowIconOnTitleBar="True"
        ShowTitleBar="True">
    <Grid />
</Controls:MetroWindow>

Mahapps, ( , -), . GitHub

+10

All Articles