void item_ShowContextMenu(object sender, PositionArgs e)
        {
            AreaItemControl item = sender as AreaItemControl;

            if (item != null)
            {
                if (item.ContextMenu.IsDropDownOpen)
                {
                    item.ContextMenu.IsDropDownOpen = false;
                }

                Raise_BeforeShowContextMenu(item);

                // Управляем доступностью кнопок Вверх/Вниз
                ListBoxItem list_Item = item.Tag as ListBoxItem;
                if (list_Item != null)
                {
                    int indx = m_List.Items.IndexOf(list_Item);
                    item.CanMoveUp   = indx > 0;
                    item.CanMoveDown = (indx > -1 && indx < m_List.Items.Count - 1);
                }
                else
                {
                    item.CanMoveUp   = false;
                    item.CanMoveDown = false;
                }

                item.ContextMenu.SetLocation(e.Position);
                item.ContextMenu.Tag            = item;
                item.ContextMenu.IsDropDownOpen = true;
            }
        }
 private void Raise_ShowContextMenu(PositionArgs args)
 {
     EventHandler<PositionArgs> handler = this.ShowContextMenu;
     if (handler != null)
     {
         handler(this, args);
     }
 }
Exemplo n.º 3
0
        private void Raise_ShowContextMenu(PositionArgs args)
        {
            EventHandler <PositionArgs> handler = this.ShowContextMenu;

            if (handler != null)
            {
                handler(this, args);
            }
        }
        void item_ShowContextMenu(object sender, PositionArgs e)
        {
            AreaItemControl item = sender as AreaItemControl;
            if (item != null)
            {
                if (item.ContextMenu.IsDropDownOpen)
                    item.ContextMenu.IsDropDownOpen = false;

                Raise_BeforeShowContextMenu(item);

                // Управляем доступностью кнопок Вверх/Вниз
                ListBoxItem list_Item = item.Tag as ListBoxItem;
                if (list_Item != null)
                {
                    int indx = m_List.Items.IndexOf(list_Item);
                    item.CanMoveUp = indx > 0;
                    item.CanMoveDown = (indx > -1 && indx < m_List.Items.Count - 1);
                }
                else
                {
                    item.CanMoveUp = false;
                    item.CanMoveDown = false;
                }

                item.ContextMenu.SetLocation(e.Position);
                item.ContextMenu.Tag = item;
                item.ContextMenu.IsDropDownOpen = true;
            }
        }