Introduction
With a period of time Mahapps.metro, the feeling is still very useful, but in the setting of the form icon when there is a problem, the following describes the problems encountered and how to solve. content problem
Mahapps.metro gives instructions on how to add an icon:
In the same way, add Resources/icons.xaml first,
Add <resourcedictionary source= "/resources/icons.xaml"/> in the App.xaml file as shown in the figure:
But there's a problem in the back, because it's not familiar to XAML, and you don't know where to add it.
<Rectangle>
<Rectangle.Fill>
<visualbrush visual= "{StaticResource appbar_add}"/>
</Rectangle.Fill>
</Rectangle>
Just started to add it to the
But there is a problem, prompting the characteristics of the wrong name, and later looked up how to add the form icon, see a question and answer: http://stackoverflow.com/questions/17508333/ Setting-window-icon-with-a-static-resource, just mentioned the question, and gave the answer. Solve
Add the following:
<Controls:MetroWindow.IconTemplate>
<DataTemplate>
<grid width= "{TemplateBinding Width}"
height= "{TemplateBinding Height}"
Margin= "4"
background= "Transparent"
renderoptions.edgemode= "aliased
" Renderoptions.bitmapscalingmode= "highquality" >
<Rectangle>
<Rectangle.Fill>
< VisualBrush visual= "{StaticResource appbar_home}"/>
</Rectangle.Fill>
</Rectangle>
</Grid>
</DataTemplate>
</Controls:MetroWindow.IconTemplate>
The final effect is as follows, I added a home icon:
Summary
Finally to everyone to share a demo, more detailed, hope can help everyone.
Https://github.com/MahApps/MahApps.Metro.Resources