void RemoveButtonFromRibbon() { RibbonControl ribbon = dashboardDesigner.Ribbon; RibbonPage page = ribbon.GetDashboardRibbonPage(DashboardBarItemCategory.PiesTools, DashboardRibbonPage.Design); RibbonPageGroup group = page.GetGroupByName(ribonPageGroupName); page.Groups.Remove(group); }
void RibbonTransformer_BarItemAdding(object sender, BarItemAddingEventArgs e) { var transformer = (ClassicToRibbonTransformer)sender; if (e.Action != null) { var findRibbonActionLink = FindRibbonActionLink(e.Action); var modelActionToContainerMapping = ((IModelActionDesignContainerMapping)Application.Model.ActionDesign).ActionToContainerMapping; foreach (IModelActionContainer v in modelActionToContainerMapping) { foreach (IModelActionLink actionLink in v) { if (actionLink.ActionId == e.Action.Id) { findRibbonActionLink = ((IModelActionLinkRibbon)actionLink).Ribbon; } } } var mapping = modelActionToContainerMapping.SelectMany(container => container).OfType <IModelActionLinkRibbon>(); foreach (var map in mapping) { if (map.ActionId == e.Action.Id) { findRibbonActionLink = map.Ribbon; } } if (findRibbonActionLink != null) { BarItemSetup(findRibbonActionLink, e.Item); RibbonPage page = e.Group.Page; if (!string.IsNullOrEmpty(findRibbonActionLink.TargetRibbonPage)) { page = transformer.FindPageByName(findRibbonActionLink.TargetRibbonPage) ?? AddPage(transformer.Ribbon, findRibbonActionLink.TargetRibbonPage); } RibbonPageGroup pageGroup = e.Group; if (!string.IsNullOrEmpty(findRibbonActionLink.TargetRibbonGroup)) { pageGroup = page.GetGroupByName(findRibbonActionLink.TargetRibbonGroup) ?? AddPageGroup(page, findRibbonActionLink.TargetRibbonGroup); } e.Group = pageGroup; } } }
void AddButtonToRibbon() { RibbonControl ribbon = dashboardDesigner.Ribbon; RibbonPage page = ribbon.GetDashboardRibbonPage(DashboardBarItemCategory.PiesTools, DashboardRibbonPage.Design); RibbonPageGroup group = page.GetGroupByName(ribonPageGroupName); if (group == null) { group = new RibbonPageGroup(ribonPageGroupName) { Name = ribonPageGroupName }; page.Groups.Add(group); } showTotalBarItem = CreateShowTotalBarItem(); totalSettingsBarItem = CreateSettingsBarItem(); group.ItemLinks.Add(showTotalBarItem); group.ItemLinks.Add(totalSettingsBarItem); }
//void OnAllowCollapsingClick(object sender, ItemClickEventArgs e) //{ // ChartDashboardItem dashboardItem = dashboardDesigner.SelectedDashboardItem as ChartDashboardItem; // MultiPaneSettings settings = MultiPaneSettings.FromJson(dashboardItem.CustomProperties[customPropertyName]); // settings.AllowPaneCollapsing = !settings.AllowPaneCollapsing; // string status = settings.AllowPaneCollapsing == true ? "enabled" : "disabled"; // CustomPropertyHistoryItem historyItem = new CustomPropertyHistoryItem(dashboardItem, customPropertyName, settings.ToJson(), $"Pane Collapsing for {dashboardItem.ComponentName} is {status}"); // dashboardDesigner.AddToHistory(historyItem); // UpdateBarItems(); //} void AddButtonToRibbon() { RibbonControl ribbon = dashboardDesigner.Ribbon; RibbonPage page = ribbon.GetDashboardRibbonPage(DashboardBarItemCategory.ChartTools, DashboardRibbonPage.Design); RibbonPageGroup group = page.GetGroupByName(ribonPageGroupName); if (group == null) { group = new RibbonPageGroup(ribonPageGroupName) { Name = ribonPageGroupName }; page.Groups.Add(group); } enableBarItem = CreateEnableBarItem(); showTitlesBarItem = CreateShowTitlesBarItem(); allowCollapsingBarItem = CreateAllowCollapsingBarItem(); layoutModeBarItem = CreateLayoutModeBarItem(); group.ItemLinks.Add(enableBarItem); group.ItemLinks.Add(showTitlesBarItem); group.ItemLinks.Add(allowCollapsingBarItem); group.ItemLinks.Add(layoutModeBarItem); }