ToggleButton 不显示任何状态 [英] ToggleButton doesn't show any state

查看:35
本文介绍了ToggleButton 不显示任何状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有史以来最简单的应用程序:单个窗口和一个切换按钮:

I've got the most simple application ever: single window with one single toggle button:

<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">
    <Grid>
        <ToggleButton Content="This is my ToggleButton" />
    </Grid>
</Window>

当我现在点击切换按钮时,实际上什么也没发生.当我为 CheckedUnchecked 事件设置事件处理程序,然后单击按钮时,首先是 Checked 然后是 Unchecked 被解雇.所以按钮似乎工作正常......

When I now click on the toggle button, really nothing happens. When I setup event handler for Checked and Unchecked event, and then click the button, first the Checked and then Unchecked get fired. So the button seems to work correctly ...

我正在编译为 .NET 4.5,并且使用的是 Windows 8 RTM.

I am compiling to .NET 4.5 and I am using Windows 8 RTM.

此行为是否与 Windows 8 样式的按钮显示(无3D"边框)有关?谁能确认一下?

更新 1我制作了一张图片来展示我的意思:

UPDATE 1 I made up an image to show what I meant:

如您所见,在 Windows 8 中,单击切换按钮时没有任何反应",它根本不会被切换".这似乎是一个错误,与显示按钮的 windows 8 风格有关 ...

As you see, in Windows 8 "nothing happens" when clicking on the toggle button, it simply does not get "toggled". This seems to be a bug, related to the windows 8 style of displaying buttons ...

更新:2013 年 5 月 30 日:可以使用修补程序:http://support.microsoft.com/kb/2805222
请参阅 WPF 下的问题 #5
不幸的是,它并没有解决我的问题:(

推荐答案

这是 WPF 中已确认的缺陷.解决方法是相应地设置控件样式,尽管产品组可能会考虑进行修复.要请求修复,请联系 Microsoft 支持.

This is a confirmed defect in WPF. The workaround is to style the control accordingly, although a fix may be considered by the product group. To request a fix, please contact Microsoft Support.

这篇关于ToggleButton 不显示任何状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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