I've faced with a problem reproduced on .NET 4.0 when UIElement.UseLayoutRounding="True"
and TextBoxBase.VerticalScrollBarVisibility="Auto"
are set together.
The issue is reproduced only on Windows Classic theme (tested on Windows 7 and XP).
When the window is loaded, WPF shows and then hides vertical scroll bar on the TextBlock in infinite loop so that UI becomes unusable.
Markup is completely simple:
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"/>
MainWindowView.xaml
:
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
UseLayoutRounding="True">
<StackPanel>
<TextBox VerticalScrollBarVisibility="Auto"/>
</StackPanel>
</Window>
Does anyone have any ideas of ways to avoid this?
There's something very funky going on in TextBoxView, the Reference Source for .NET 4.5 documents bug number 1766924 with a patch that disables background layout calculation for VerticalScrollBarVisibility=Auto. Quoting:
// Workaround for bug 1766924.
// When VerticalScrollBarVisiblity == Auto, there's a problem with
// our interaction with ScrollViewer. Disable background layout to
// mitigate the problem until we can take a real fix in v.next.
//
This appears to be connected to this feedback article that describes your exact observation.
Known problem in .NET 4.0, fixed in 4.5. Ask the users that suffer from this problem to install .NET 4.5 on their machine. Note the workaround proposed by rfboilers if you need to keep XP users happy.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With