private void ActionControlsSiteController_CustomAddActionControlToContainer(object sender, DevExpress.ExpressApp.Templates.ActionControls.CustomAddActionControlEventArgs e)
 {
     if (!(Frame.Template is RibbonForm))
     {
         return;
     }
     if ((e.Container is BarLinkActionControlContainer) && (e.Action.Id == ChangeVariantController.ChangeVariantActionId))
     {
         BarLinkActionControlContainer barLinkControlContainer = (BarLinkActionControlContainer)e.Container;
         if (!barLinkControlContainer.IsMenuMode)
         {
             barLinkControlContainer.AddBarButtonItemSingleChoiceActionControl(ChangeVariantController.ChangeVariantActionId, DevExpress.ExpressApp.Actions.SingleChoiceActionItemType.ItemIsMode);
             e.Handled = true;
         }
     }
 }
Example #2
0
 private static void WinApplication_CustomizeTemplate(object sender, CustomizeTemplateEventArgs e)
 {
     if (e.Context == TemplateContext.ApplicationWindow || e.Context == TemplateContext.View)
     {
         RibbonForm          ribbonForm         = e.Template as RibbonForm;
         IActionControlsSite actionControlsSite = ribbonForm as IActionControlsSite;
         if ((ribbonForm != null) && (actionControlsSite != null))
         {
             IActionControlContainer filtersActionControlContainer = actionControlsSite.ActionContainers.FirstOrDefault <IActionControlContainer>(x => x.ActionCategory == "Filters");
             if (filtersActionControlContainer is BarLinkActionControlContainer)
             {
                 BarLinkActionControlContainer barFiltersActionControlContainer = (BarLinkActionControlContainer)filtersActionControlContainer;
                 BarLinkContainerItem          barFiltersItem = barFiltersActionControlContainer.BarContainerItem;
                 RibbonControl ribbonControl = ribbonForm.Ribbon;
                 foreach (RibbonPage page in ribbonControl.Pages)
                 {
                     foreach (RibbonPageGroup group in page.Groups)
                     {
                         BarItemLink barFiltersItemLink = group.ItemLinks.FirstOrDefault <BarItemLink>(x => x.Item == barFiltersItem);
                         if (barFiltersItemLink != null)
                         {
                             group.ItemLinks.Remove(barFiltersItemLink);
                         }
                     }
                 }
                 ribbonForm.Ribbon.PageHeaderItemLinks.Add(barFiltersItem);
             }
         }
     }
     else if ((e.Context == TemplateContext.LookupControl) || (e.Context == TemplateContext.LookupWindow))
     {
         LookupControlTemplate lookupControlTemplate = e.Template as LookupControlTemplate;
         if (lookupControlTemplate == null && e.Template is LookupForm)
         {
             lookupControlTemplate = ((LookupForm)e.Template).FrameTemplate;
         }
         if (lookupControlTemplate != null)
         {
             lookupControlTemplate.ObjectsCreationContainer.ContainerId = "LookupNew";
             lookupControlTemplate.SearchActionContainer.ContainerId    = "LookupFullTextSearch";
         }
     }
 }
Example #3
0
        private void Application_CustomizeTemplate(object sender, CustomizeTemplateEventArgs e)
        {
            RibbonForm ribbonForm = e.Template as RibbonForm;

            if (ribbonForm != null && ribbonForm.Ribbon is XafRibbonControlV2)
            {
                XafRibbonControlV2 ribbonControl = ribbonForm.Ribbon as XafRibbonControlV2;
                ribbonControl.BeginInit();
                foreach (IModelRibbonAction modelAction in modelActions.Select(action => action).Cast <IModelRibbonAction>().Where(a => !string.IsNullOrEmpty(a.TargetRibbonPage)))
                {
                    RibbonPage page = null;
                    page = ribbonControl.Pages.GetPageByText(modelAction.TargetRibbonPage);
                    if (page == null)
                    {
                        page      = new RibbonPage(modelAction.TargetRibbonPage);
                        page.Name = modelAction.TargetRibbonPage;
                        ribbonControl.Pages.Add(page);
                    }

                    var group = page.Groups.GetGroupByText(modelAction.TargetRibbonGroup);
                    if (group == null)
                    {
                        var ribbonGroup = new RibbonPageGroup(modelAction.TargetRibbonGroup);
                        ribbonGroup.Name = modelAction.TargetRibbonGroup;
                        ribbonGroup.AllowTextClipping = false;
                        page.Groups.Add(ribbonGroup);

                        var barLinkContainerExItem = new BarLinkContainerExItem();
                        ribbonControl.Items.Add(barLinkContainerExItem);
                        ribbonGroup.ItemLinks.Add(barLinkContainerExItem);

                        var actionContainer = new BarLinkActionControlContainer();
                        actionContainer.BeginInit();
                        ribbonControl.ActionContainers.Add(actionContainer);
                        actionContainer.ActionCategory   = modelAction.TargetRibbonGroup;
                        actionContainer.BarContainerItem = barLinkContainerExItem;
                        actionContainer.EndInit();
                    }
                }
                ribbonControl.EndInit();
            }
        }
Example #4
0
 private void actionControlsSiteController_CustomAddActionControlToContainer(object sender, CustomAddActionControlEventArgs e)
 {
     if (e.Action is CheckableSimpleAction)
     {
         if (e.Container is BarLinkActionControlContainer)
         {
             BarLinkActionControlContainer container = (BarLinkActionControlContainer)e.Container;
             IActionControl actionControl            = CreateActionControl(e.Action.Id, container.BarContainerItem);
             container.AddActionControl(actionControl);
             e.Handled = true;
         }
         if (e.Container is RibbonGroupActionControlContainer)
         {
             RibbonGroupActionControlContainer container = (RibbonGroupActionControlContainer)e.Container;
             IActionControl actionControl = CreateActionControl(e.Action.Id, container.RibbonGroup.ItemLinks);
             container.AddActionControl(actionControl);
             e.Handled = true;
         }
     }
 }