A fast, cross-platform report and document viewer for .NET reporting, ComponentOne FlexViewer offers a complete control toolkit that can be used to preview many different document types, including a C1Report, C1FlexReport, SSRS, and PDF documents.
This control offers a Ribbon that consists of standard Ribbon items. At times, you may need to hide these standard buttons or add a custom button in the Ribbon.
There are two ways to change the visibility of standard buttons:
I. When designing, use RibbonElements collection editor.
Go to the Properties window.
Expand RibbonElements property.
Change the Visible property of the desired ButtonActionElement.
II. At run time, you can use any of the following methods:
//Hide Refresh button from the Ribbon
ButtonActionElement _btnRefresh= _flxViewer.RibbonElements.Refresh;
_btnRefresh.Visible = false;
//Hide Print button from the Ribbon
_flxViewer.RibbonGroups.Tools.RibbonGroup.Items[0].Visible = false;
You can add a RibbonItem in the RibbonGroup programmatically:
// Add a custom Print button and hide the standard one
RibbonButton _btnCustomPrint = new RibbonButton();
//Get standard Print button
RibbonItem _btnPrint = _flxViewer.RibbonGroups.Tools.RibbonGroup.Items[0];
_btnCustomPrint.LargeImage = _btnPrint.LargeImage;
_btnCustomPrint.SmallImage = _btnPrint.SmallImage;
_btnCustomPrint.ToolTip = "Custom button to print current report";
_btnCustomPrint.TextImageRelation = _btnPrint.TextImageRelation;
_btnCustomPrint.Text = "Custom print";
//Add event handler
_btnCustomPrint.Click += _btnCustomPrint_Click;
_flxViewer.RibbonGroups.Tools.RibbonGroup.Items.Insert(1, _btnCustomPrint);
Desktop: WinForms, WPF, and UWP
Web: ASP.NET MVC
Try the fastest way to build high-performing, feature-complete applications.