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
{
///
/// 主窗口菜单页面
///
public partial class MainWindowMenu : UserControl
{
// ------------事件--------------
public static readonly RoutedEvent ItemClickEvent = EventManager.RegisterRoutedEvent("ItemClick", RoutingStrategy.Bubble, typeof(EventHandler), 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
{
///
/// 点击信息
///
public string Tag { get; set; }
public MenuItemRoutedEventArgs(RoutedEvent routedEvent, object source, string tag) : base(routedEvent, source)
{
Tag = tag;
}
}
}