我面临着.NET 4.0,当再现问题UIElement.UseLayoutRounding="True",并TextBoxBase.VerticalScrollBarVisibility="Auto"设置在一起.该问题仅在Windows Classic主题(在Windows 7和XP上测试)上重现.
加载窗口时,WPF显示然后在无限循环中隐藏TextBlock上的垂直滚动条,以便UI变得不可用.
标记非常简单:
App.xaml:
<Application x:Class="PhysioControl.CodeStat.UI.Reviewer.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindowView.xaml"/>
Run Code Online (Sandbox Code Playgroud)
MainWindowView.xaml:
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
UseLayoutRounding="True">
<StackPanel>
<TextBox VerticalScrollBarVisibility="Auto"/>
</StackPanel>
</Window>
Run Code Online (Sandbox Code Playgroud)
有没有人有任何想法避免这种想法?
先决条件:在 Windows 区域设置中选择英语(美国)格式。在附加设置中,通过指定连字符作为分隔符(如“HH-mm-ss”)来自定义时间格式。
进行这些更改后,以下代码将失败并显示 FormatException(String 未被识别为有效的 DateTime。):
DateTime.Parse(DateTime.Now.ToString());
Run Code Online (Sandbox Code Playgroud)
在 .NET 4.0 和 4.5 中复制。有没有办法避免这个问题?