From 9d1660270272180cd71147d6ddd53d1382643d2e Mon Sep 17 00:00:00 2001
From: wenxiangchao <wenxiangchao@ihengxin.com.cn>
Date: 星期一, 02 十一月 2026 18:00:14 +0800
Subject: [PATCH] merge: 并入远程 Initial commit 作为历史根节点

---
 WPFProject/Controls/MenuTabControl.xaml.cs |  168 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 168 insertions(+), 0 deletions(-)

diff --git a/WPFProject/Controls/MenuTabControl.xaml.cs b/WPFProject/Controls/MenuTabControl.xaml.cs
new file mode 100644
index 0000000..8d0b400
--- /dev/null
+++ b/WPFProject/Controls/MenuTabControl.xaml.cs
@@ -0,0 +1,168 @@
+锘縰sing HMI.Core.Api;
+using System;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace WPFProject.Controls
+{
+    /// <summary>
+    /// MenuTabControl.xaml 鐨勪氦浜掗�昏緫
+    /// </summary>
+    public partial class MenuTabControl : UserControl, INotifyPropertyChanged
+    {
+        public virtual event PropertyChangedEventHandler PropertyChanged;
+
+        protected virtual void RaisePropertyChanged(string name)
+        {
+
+            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
+        }
+
+        protected void RaiseAndSetIfChanged<T>(ref T old, T @new, [CallerMemberName] string propertyName = null)
+        {
+            old = @new;
+            if (propertyName != null)
+            {
+                RaisePropertyChanged(propertyName);
+            }
+        }
+
+        private Visibility ItemVisibility = Visibility.Collapsed;
+
+        //public event EventHandler ClassHandlerProcessed;
+        //public static void CustomClickClassHandler(object sender, RoutedEventArgs e)
+        //{
+        //    MenuTabControl simpleBtn = sender as MenuTabControl;
+        //    EventArgs args = new EventArgs();
+        //    simpleBtn.ClassHandlerProcessed(simpleBtn, args);
+        //}
+
+
+        // Tab鍒囨崲浜嬩欢
+        public static readonly RoutedEvent OnTabChangeEvent =
+             EventManager.RegisterRoutedEvent("OnTabChange", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(MenuTabControl));
+
+        public event RoutedEventHandler OnTabChange
+        {
+            add
+            {
+                AddHandler(OnTabChangeEvent, value);
+            }
+
+            remove
+            {
+                RemoveHandler(OnTabChangeEvent, value);
+            }
+        }
+
+
+
+        private ObservableCollection<IconTabItem> _Items;
+
+        public ObservableCollection<IconTabItem> Items
+        {
+            get { return _Items; }
+            set => RaiseAndSetIfChanged(ref _Items, value);
+        }
+
+        private ObservableCollection<IconTabItem> _Items_Level2;
+
+        public ObservableCollection<IconTabItem> Items_Level2
+        {
+            get { return _Items_Level2; }
+            set => RaiseAndSetIfChanged(ref _Items_Level2, value);
+        }
+
+        private IconTabItem _TabSelectedItem;
+
+        public IconTabItem TabSelectedItem
+        {
+            get { return _TabSelectedItem; }
+            set => RaiseAndSetIfChanged(ref _TabSelectedItem, value);
+        }
+
+
+        private Visibility _ShowMenu;
+
+        public Visibility ShowMenu
+        {
+            get { return _ShowMenu; }
+            set => RaiseAndSetIfChanged(ref _ShowMenu, value);
+        }
+
+        private event EventHandler<SelectionChangedEventArgs> ChildTabChanged;
+
+
+        public MenuTabControl()
+        {
+            //IPlugin plugin = new WorkControl();
+            //ChildTabChanged += plugin.OnTabChange;
+
+            //DataContext = this;
+            //InitializeComponent();
+            //Items = new ObservableCollection<IconTabItem> {
+            //new IconTabItem(){
+            //    Header="111",
+            //    Children = new ObservableCollection<IconTabItem>{
+            //        new IconTabItem(){
+            //            Header = "112",
+            //            Content = plugin
+            //        }
+            //    }
+            //},
+            //new IconTabItem(){
+            //    Header="222",
+            //    Children = new ObservableCollection<IconTabItem>()
+            //}
+            //};
+        }
+
+        private void UserControl_Loaded(object sender, RoutedEventArgs e)
+        {
+            // SetItemVisibility();
+            //Window main = Window.GetWindow(this);
+            //foreach (IconTabItem item in Items)
+            //{
+            //    if (item.Body != null)
+            //    {
+            //        Win32Helper.SetParentForWPF(item.Body, main);
+            //    }
+            //}
+        }
+
+        private void tabLevel_1_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+            ChildTabChanged?.Invoke(this, e);
+            RoutedEventArgs ee = new RoutedEventArgs(OnTabChangeEvent);
+            RaiseEvent(ee);
+        }
+
+        public void ChangeItemVisibility()
+        {
+            ItemVisibility = ItemVisibility == Visibility.Visible ? Visibility.Collapsed : Visibility.Visible;
+            SetItemVisibility();
+        }
+
+        private void SetItemVisibility()
+        {
+            if (Items == null)
+            {
+                return;
+            }
+            foreach (IconTabItem item in Items)
+            {
+                item.Visibility = ItemVisibility;
+                if (item.Children != null)
+                {
+                    foreach (var child in item.Children)
+                    {
+                        child.Visibility = ItemVisibility;
+                    }
+                }
+            }
+        }
+    }
+}

--
Gitblit v1.9.1