ModernWpf
ModernWpf copied to clipboard
[BUG] Rendering bug when `SizeToContent` is set.
I have code like this:
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
x:Class="ImageTemplateEditor.Views.MainWindow"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ImageTemplateEditor"
xmlns:views="clr-namespace:ImageTemplateEditor.Views"
xmlns:ui="http://schemas.modernwpf.com/2019"
mc:Ignorable="d"
ui:WindowHelper.UseModernWindowStyle="True"
SizeToContent="WidthAndHeight"
Title="example">
<ui:Frame
x:Name="ContentFrame">
<ui:Frame.ContentTransitions>
<ui:TransitionCollection>
<ui:NavigationThemeTransition>
<ui:DrillInNavigationTransitionInfo/>
</ui:NavigationThemeTransition>
</ui:TransitionCollection>
</ui:Frame.ContentTransitions>
<ui:Frame.Content>
<views:Welcome/>
</ui:Frame.Content>
</ui:Frame>
</Window>
its page is dynamically changing.
If run it, black square would appear.
After some trying, if I remove the line ui:WindowHelper.UseModernWindowStyle="True"
, the black square won't show up again.
I guess there is something to do with the style calculation.
FYI, I am experiencing the same issue. If I allow resize on the window, as soon as I drag the corner the layout updates and the problem goes away. Not really a solution but I thought it might be useful info.
Initial view (note the position of the drag handle):
As soon as I grab the handle the window layout updates:
Hi,
I too am seeing this behavior with SizeToContent
set. The following workaround does seem to address the UI glitch:
SourceInitialized += (s, a) =>
{
Dispatcher.Invoke(InvalidateVisual, DispatcherPriority.Input);
};
This works for deleting lines. But this fix makes the dialog appear larger at the bottom compared to the original. In my case, about 40 px white space was added below.