Example #1
0
        void CreateMenu()
        {
            isInitializing    = true;
            contextMenu       = new ContextMenu();
            contextMenu.Owner = this;
            contextMenu.Items.Add(gallery);
            AddLogicalChild(contextMenu.RibbonPopup);
            contextMenu.IsOpen = true;

            contextMenu.RibbonPopup.Opened += OnMenuOpened;
            contextMenu.RibbonPopup.Closed += OnMenuClosed;
            Binding binding = new Binding("IsOpen");

            binding.Mode   = BindingMode.TwoWay;
            binding.Source = this;
            contextMenu.SetBinding(Fluent.ContextMenu.IsOpenProperty, binding);

            binding        = new Binding("ResizeMode");
            binding.Mode   = BindingMode.OneWay;
            binding.Source = this;
            contextMenu.SetBinding(Fluent.ContextMenu.ResizeModeProperty, binding);

            contextMenu.PlacementTarget = contentBorder;
            contextMenu.Placement       = PlacementMode.Bottom;

            isInitializing     = false;
            IsOpen             = true;
            contextMenu.IsOpen = true;
        }
Example #2
0
        // Creates context menu
        void CreateMenu()
        {
            isInitializing = true;
            isMenuCreated  = true;
            if (dropDownMenu == null)
            {
                dropDownMenu = new ContextMenu();
            }
            foreach (UIElement item in Items)
            {
                RemoveLogicalChild(item);
                dropDownMenu.Items.Add(item);
            }
            AddLogicalChild(dropDownMenu.RibbonPopup);
            dropDownMenu.IsOpen              = true;
            dropDownMenu.RibbonPopup.Opened += OnMenuOpened;
            dropDownMenu.RibbonPopup.Closed += OnMenuClosed;

            Binding binding = new Binding("IsOpen");

            binding.Mode   = BindingMode.TwoWay;
            binding.Source = this;
            dropDownMenu.SetBinding(Fluent.ContextMenu.IsOpenProperty, binding);

            Binding resizeModeBinding = new Binding("ResizeMode");

            resizeModeBinding.Mode   = BindingMode.OneWay;
            resizeModeBinding.Source = this;
            dropDownMenu.SetBinding(Fluent.ContextMenu.ResizeModeProperty, resizeModeBinding);

            dropDownMenu.PlacementTarget = this;
            dropDownMenu.Placement       = PlacementMode.Bottom;

            isInitializing = false;
            Mouse.Capture(null);
            IsOpen = true;
            dropDownMenu.IsOpen = true;
        }
Example #3
0
        // Creates context menu
        void CreateMenu()
        {
            contextMenu = new ContextMenu();
            foreach (UIElement item in Items)
            {
                RemoveLogicalChild(item);
                contextMenu.Items.Add(item);
            }
            contextMenu.IsOpen = true;
            Binding binding = new Binding("IsOpen");

            binding.Mode   = BindingMode.TwoWay;
            binding.Source = this;
            contextMenu.SetBinding(Fluent.ContextMenu.IsOpenProperty, binding);

            contextMenu.PlacementTarget = this;
            contextMenu.Placement       = PlacementMode.Right;

            AddLogicalChild(contextMenu.RibbonPopup);
        }
        // Creates context menu
        void CreateMenu()
        {
            contextMenu = new ContextMenu();
            foreach (UIElement item in Items)
            {
                RemoveLogicalChild(item);
                contextMenu.Items.Add(item);
            }
            contextMenu.IsOpen = true;
            Binding binding = new Binding("IsOpen");
            binding.Mode = BindingMode.TwoWay;
            binding.Source = this;
            contextMenu.SetBinding(Fluent.ContextMenu.IsOpenProperty, binding);
            
            contextMenu.PlacementTarget = this;
            contextMenu.Placement = PlacementMode.Right;

            AddLogicalChild(contextMenu.RibbonPopup);
        }