- 功能实现效果如下:
后台.CS页面代码如下:
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
namespace WPF_Client.Resources.Controls
{
/// <summary>
/// UCTabItemWithClose.xaml 的交互逻辑
/// </summary>
public partial class UCTabItemWithClose : TabItem
{
public UCTabItemWithClose()
{
InitializeComponent();
}
#region 成员变量
/// <summary>
/// 父级TabControl
/// </summary>
private TabControl m_Parent;
/// <summary>
/// 约定的宽度
/// </summary>
private double m_ConventionWidth = 100;
#endregion
//页面加载事件
private void TabItem_Loaded(object sender, RoutedEventArgs e)
{
//找到父级