WinUI 2 Xaml islands NavigationViewItem.Content property set TextBlock cause app crash #9220
Labels
area-External
Not owned by the WinUI team, not actionable in this repository.
area-NavigationView
NavView control
bug
Something isn't working
product-winui2
team-Controls
Issue for the Controls team
Describe the bug
WinUI 2 Xaml islands NavigationViewItem.Content property set TextBlock cause app crash.
When I use the navigation control of WinUI2 in Mile.Xaml, when I try to set the Content property as a string value directly in the NavigationViewItem, the application works fine and can display the string, but when the Content property is set to a Textblock, the application is abnormal, and the value does not fall within the expected range.
我在Mile.Xaml中使用 WinUI2的导航控件时,当尝试在NavigationViewItem中直接设置Content属性为字符串值时,应用程序正常运行,并能显示出字符串,但是当Content属性设置成一个Textblock 时,应用发生异常,提示Value does not fall within the expected range.
Steps to reproduce the bug
See ScreenShots
Expected behavior
在NavigationViewItem.Content 属性中设置 Textblock 时可以正常显示。
When the Textblock is set in the NavigationViewItem.Content property, it appears as expected.
Screenshots
NuGet package version
WinUI 2 - Microsoft.UI.Xaml 2.8.2
Windows version
Windows 11 (22H2): Build 22621
Additional context
希望能在2.8.7版本中修复这个问题
Hopefully this will be fixed in version 2.8.7
异常信息
Source:
StackTrace:
HelpLink:
HResult:-2147024809
Message:参数错误。
参数错误。
Source:
StackTrace: at Windows.UI.Xaml.UIElement.Measure(Size availableSize)
at Mile.Xaml.WindowsXamlHostBase.OnWindowXamlHostSizeChanged(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnSizeChanged(EventArgs e)
at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height, Int32 clientWidth, Int32 clientHeight)
at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height)
at System.Windows.Forms.Control.SetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)
at System.Windows.Forms.Control.System.Windows.Forms.Layout.IArrangedElement.SetBounds(Rectangle bounds, BoundsSpecified specified)
at System.Windows.Forms.Layout.DefaultLayout.xLayoutDockedControl(IArrangedElement element, Rectangle newElementBounds, Boolean measureOnly, Size& preferredSize, Rectangle& remainingBounds)
at System.Windows.Forms.Layout.DefaultLayout.LayoutDockedControls(IArrangedElement container, Boolean measureOnly)
at System.Windows.Forms.Layout.DefaultLayout.xLayout(IArrangedElement container, Boolean measureOnly, Size& preferredSize)
at System.Windows.Forms.Layout.DefaultLayout.LayoutCore(IArrangedElement container, LayoutEventArgs args)
at System.Windows.Forms.Layout.LayoutEngine.Layout(Object container, LayoutEventArgs layoutEventArgs)
at System.Windows.Forms.Control.OnLayout(LayoutEventArgs levent)
at System.Windows.Forms.Form.OnLayout(LayoutEventArgs levent)
at System.Windows.Forms.Control.PerformLayout(LayoutEventArgs args)
at System.Windows.Forms.Control.OnResize(EventArgs e)
at System.Windows.Forms.Form.OnResize(EventArgs e)
at System.Windows.Forms.Control.OnSizeChanged(EventArgs e)
at WindowsTools.Views.Windows.MainWindow.OnSizeChanged(EventArgs args)
at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height, Int32 clientWidth, Int32 clientHeight)
at System.Windows.Forms.Control.UpdateBounds()
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at WindowsTools.Views.Windows.MainWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
HelpLink:
HResult:-2147024809
Message:Value does not fall within the expected range.
The text was updated successfully, but these errors were encountered: