WPF 强制刷新TabControl 的Header

xml 复制代码
<hc:TabControl
    Name="TabControl"
    Grid.Row="0"
    Background="{StaticResource TitleBackground}"
    BorderBrush="#111"
    BorderThickness="0"
    IsScrollable="True"
    ItemsSource="{Binding PageInfoList}"
    SelectedIndex="{Binding ChannelIndex}"
    ShowContextMenu="False"
    TabItemWidth="100">
    <hc:TabControl.ItemTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding Header}" />
        </DataTemplate>
    </hc:TabControl.ItemTemplate>
    <hc:TabControl.ContentTemplate>
        <DataTemplate>
            <ContentPresenter Content="{Binding Content, Mode=OneTime}" />
        </DataTemplate>
    </hc:TabControl.ContentTemplate>
</hc:TabControl>
csharp 复制代码
            ((MainWindow)Window).TabControl.Items.Refresh(); // 强制刷新 TabControl
相关推荐
默 语7 小时前
HarmonyOS7基础属性全解(四):显隐控制 visibility——藏起来、占着位、干脆不存在,是三回事
wpf
陈仓主教10 小时前
WPF 菜单(Menu)控件详解与使用—WPF 中的控件(23)--菜单(Menu)
wpf
qq_452396232 天前
第十篇:分布式事务架构如何设计?从 Outbox 到 Saga 的生产级选型指南
分布式·架构·wpf
凌镜icecraft8 天前
我改文件扩展名的时候那个警告弹窗再也不会弹出来了
windows·c#·wpf·explorer
光泽雨12 天前
控件Password附加属性
wpf
samble17 天前
从零搭建半导体设备上位机(十二):参数设置页,表单校验、范围校验与配方联动
wpf·数据校验·validationrule
samble25 天前
从零搭建半导体设备上位机(九):拖拽与交互,Adorner、DragDrop 与晶圆拖放信息
wpf·拖拽·adorner
郝学胜-神的一滴1 个月前
AI 编程智能体 27:吃透MCP通信机制
人工智能·python·langchain·wpf·numpy·scikit-learn
波力海苔夹心脆6751 个月前
C# WPF 资源字典详解:ResourceDictionary、MergedDictionaries 与自定义控件案例
开发语言·c#·wpf·入门教程·resource·资源字典
陈仓主教1 个月前
# WPF CheckBox 控件详解与使用—WPF 中的控件(6)--复选框控件(CheckBox)
wpf