Ejemplo n.º 1
0
        private void _buttonMenu_Click(object sender, RoutedEventArgs e)
        {
            ContextMenu contextMenu = new ContextMenu();
            MenuItem    menuItem    = null;

            int count = IViewContainer.GetUserControlCount();

            if (count > 2)
            {
                menuItem           = new MenuItem();
                menuItem.Header    = "Ungroup Current";
                menuItem.IsChecked = false;
                menuItem.Command   = new Command(delegate { UngroupCurrent?.Invoke(this, null); }, delegate { return(true); });
                contextMenu.Items.Add(menuItem);
            }

            if (count > 1)
            {
                menuItem           = new MenuItem();
                menuItem.Header    = "Ungroup";
                menuItem.IsChecked = false;
                menuItem.Command   = new Command(delegate { Ungroup?.Invoke(this, null); }, delegate { return(true); });
                contextMenu.Items.Add(menuItem);
            }

            menuItem           = new MenuItem();
            menuItem.Header    = "Freeze Aspect Ratio";
            menuItem.IsChecked = false;
            contextMenu.Items.Add(menuItem);

            contextMenu.IsOpen = true;
        }
Ejemplo n.º 2
0
        protected void DisplayGeneralMenu()
        {
            ContextMenu contextMenu = new ContextMenu();
            MenuItem    menuItem    = new MenuItem();

            menuItem.Header    = "Float";
            menuItem.IsChecked = false;
            menuItem.Command   = new Command(delegate { FireFloat(false); }, delegate { return(true); });
            contextMenu.Items.Add(menuItem);

            int viewCount = IViewContainer.GetUserControlCount();

            if (viewCount > 2)
            {
                menuItem           = new MenuItem();
                menuItem.Header    = "Ungroup Current";
                menuItem.IsChecked = false;
                menuItem.Command   = new Command(delegate { UngroupCurrent?.Invoke(this, null); }, delegate { return(true); });
                contextMenu.Items.Add(menuItem);
            }

            if (viewCount > 1)
            {
                menuItem           = new MenuItem();
                menuItem.Header    = "Ungroup";
                menuItem.IsChecked = false;
                menuItem.Command   = new Command(delegate { Ungroup?.Invoke(this, null); }, delegate { return(true); });
                contextMenu.Items.Add(menuItem);
            }

            contextMenu.IsOpen = true;
        }