Exemplo n.º 1
0
        void act_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
        {
            e.Handled = true;
            IActivity iact = sender as IActivity;

            if (null == iact)
            {
                return;
            }
            _Cm.Visibility = System.Windows.Visibility.Visible;
            _Cm.Items.Clear();
            var cm = iact.ContextMenu();

            foreach (var v in cm)
            {
                MenuItem mi = new MenuItem();
                mi.Header = v.Header;
                mi.Tag    = v;
                mi.Click += mi_Click;
                _Cm.Items.Add(mi);
            }
            var p = e.GetPosition(print);

            Canvas.SetLeft(_Cm, p.X);
            Canvas.SetTop(_Cm, p.Y);
            Canvas.SetZIndex(_Cm, 1000);
        }