using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace NEIntelligentControl2.Views.MainWindow
{

    /// <summary>
    /// 主窗口菜单页面
    /// </summary>
    public partial class MainWindowMenu : UserControl
    {
        // ------------事件--------------
        public static readonly RoutedEvent ItemClickEvent = EventManager.RegisterRoutedEvent("ItemClick", RoutingStrategy.Bubble, typeof(EventHandler<MenuItemRoutedEventArgs>), typeof(MainWindowMenu));
        public event RoutedEventHandler ItemClick { add { AddHandler(ItemClickEvent, value); } remove { RemoveHandler(ItemClickEvent, value); } }
        public MainWindowMenu()
        {
            InitializeComponent();
        }

        private void Grid_MouseUp(object sender, MouseButtonEventArgs e)
        {
            MenuItemRoutedEventArgs mre = new MenuItemRoutedEventArgs(ItemClickEvent, this, ((Grid)sender).Tag as string);
            RaiseEvent(mre);
        }
    }

    public class MenuItemRoutedEventArgs : RoutedEventArgs
    {
        /// <summary>
        /// 点击信息
        /// </summary>
        public string Tag { get; set; }
        public MenuItemRoutedEventArgs(RoutedEvent routedEvent, object source, string tag) : base(routedEvent, source)
        {
            Tag = tag;
        }
    }
}