向TabView添加标签时自定义标题栏拖拽区域状态异常问题
问题:TabView添加标签页时标题栏拖拽区域状态反复切换且XAML调试工具栏跳动
当向TabView中添加新标签页时,标题栏拖拽区域(titlebar drag region)会在启用与禁用状态间反复切换,视觉上无明显变化,但每次添加标签都会触发该状态变更,同时XAML Debug toolbar会出现上下跳动的现象。
最小复现示例
XAML代码
<Window x:Class="TitleBar_Bug_Test.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:TitleBar_Bug_Test" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" Title="TitleBar Bug Test"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="48"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <TabView Grid.Row="1" AddTabButtonClick="TabView_AddTabButtonClick"/> </Grid> </Window>
C#代码
public sealed partial class MainWindow : Window { public MainWindow() { this.InitializeComponent(); Microsoft.UI.Windowing.AppWindow appWindow = this.AppWindow; var titleBar = appWindow.TitleBar; titleBar.ExtendsContentIntoTitleBar = true; titleBar.PreferredHeightOption = TitleBarHeightOption.Tall; } private void TabView_AddTabButtonClick(TabView sender, object args) { var newTab = new TabViewItem(); newTab.IconSource = new SymbolIconSource() { Symbol = Symbol.Document }; newTab.Header = "New Page"; // The Content of a TabViewItem is often a frame which hosts a page. Frame frame = new Frame(); newTab.Content = frame; frame.Navigate(typeof(TestPage)); sender.TabItems.Add(newTab); } }
问题现象截图



请问是否有人知晓该问题的成因?
内容的提问来源于stack exchange,提问作者MAabmets
相关产品推荐
相关产品推荐

