使用MahApps.Metro时,应用程序图标会延伸到标题栏高度 [英] Application icon stretches to title bar height when using MahApps.Metro

查看:416
本文介绍了使用MahApps.Metro时,应用程序图标会延伸到标题栏高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用MahApps.Metro时,如何防止应用程序图标拉伸到标题栏的高度?无论使用何种大小的图标,图标和标题栏边缘之间都没有空格。我也尝试使用多尺寸图标,这不起作用。

How to prevent application icon from stretching to the height of the title bar when using MahApps.Metro? No spaces between icon and title bar edges no matter what size of icon used. I have also tried using multi-sized icons and this does not work.

这是一个开箱即用的示例:

Here is an example out of the box of what it looks like:

推荐答案

受到 mahapps punker76的代码,你可以这样做:

<MahApps:MetroWindow.IconTemplate>
    <DataTemplate>
        <Grid Width="{TemplateBinding Width}"
                 Height="{TemplateBinding Height}"
                 Margin="4"
                 Background="Transparent"
                 RenderOptions.EdgeMode="Aliased"
                 RenderOptions.BitmapScalingMode="HighQuality">
            <Image Source="Images/Document Alignment.ico"></Image>
        </Grid>
    </DataTemplate>
</MahApps:MetroWindow.IconTemplate>

但Icon Margin属性可能更简单。

But a Icon Margin property could be simpler.

这篇关于使用MahApps.Metro时,应用程序图标会延伸到标题栏高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆