选定的TabItem中的图像不清晰 [英] Images are not sharp in selected TabItem

查看:151
本文介绍了选定的TabItem中的图像不清晰的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个TabControl。每个TabItem的标题包含一个带有图标和标签的StackPanel。

I have a TabControl. The header of each TabItem contains a StackPanel with an icon and a Label.

<TabControl>
  <TabItem>
    <TabItem.Header>
      <StackPanel Orientation="Horizontal">
        <Image Source="/LoginPanel;component/Icons/icoLogin.ico"</Image>
        <Label VerticalContentAlignment="Center">Login</Label>
        </StackPanel>
      </TabItem.Header>
    </TabItem.Header>
    <!--some further code here-->
  <TabItem>
  <!--some further code here-->
<TabControl>

每个未选中的TabItem中的每个图标都按预期显示。当前所选TabItem中的图标有些混浊。如果我切换到另一个标签,取消选择的标签图标变得清晰;新选择的图标变为阴天。

Each icon in each non-selected TabItem is displayed as expected. The Icon in the currently selected TabItem is somewhat cloudy. If I switch to another Tab, the de-selected Tab-Icon becomes clear; the new selected Icon becomes cloudy.

我已尝试以下方法解决此问题:

I already tried the following to solve this:

SnapsToDevicePixels="True"

但没有任何反应

Width="32" Height="32"

Stretch="None"

以防止缩放。
所有这一切都没有任何影响。有人可以给我一些提示吗?提前致谢

to prevent scaling. All of this without any effect. Can some please give me a hint? Thanks in advance

推荐答案

这对我有用:

<Image Source="/LoginPanel;component/Icons/icoLogin.ico"
       RenderOptions.BitmapScalingMode="NearestNeighbor"</Image>

这篇关于选定的TabItem中的图像不清晰的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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