我有一个非常简单的应用程序:一个窗口和一个切换按钮:
<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>
当我现在点击切换按钮时,确实什么也不会发生。当我为
Checked
和Unchecked
事件设置事件处理程序,然后单击按钮,首先触发Checked
,然后触发Unchecked
。所以按钮似乎工作正常...我正在编译到.NET 4.5,并且我正在使用Windows 8 RTM。
这种行为与Windows 8显示按钮的风格有关吗(没有“3D”边框)?有人可以确认吗?
更新1 我制作了一张图片来展示我的意思:
如你所见,在Windows 8中,当单击切换按钮时,“什么也不会发生”,它根本没有被“切换”。 这似乎是一个错误,与Windows 8显示按钮的风格有关...
更新:2013年5月30日: 有一个热修复程序可用:http://support.microsoft.com/kb/2805222 请参见WPF下的问题#5。 不幸的是,对我来说它并没有修复问题 :(