I'm using VS2010 and Crystal reports 13.
Is there any way to collapse/hide the group tree box that appears on the left hand side of my generated report? I saw a couple of proposed solutions but none seem to work for me.
Thanks in advance.
To show or hide Crystal Reports From the Application Settings list, choose Foundation > Advanced Options > Show/Hide Crystal Reports, and then click Open.
Basically, Crystal Reports has been the reporting tool of choice included with Visual Studio. While the Crystal Report engine is not included with VS 2010, there is still a Crystal Report template included that stubs our project as a Crystal Reports project.
Crystal Report is a Reporting application that can generate reports from various Data Sources . We can Create Reports , Print and Print Preview of reports from Crystal Reports . Crystal Reports are compatible with most popular development environments like VB.NET etc. and SQL Server also .
There also is a property on report viewer you can set as follows:
yourViewer.ToggleSidePanel = Constants.SidePanelKind.None;
I think this is a bit safer in case the Crystal Reports team decides to rename that button.
I finally found a solution that works, by manually finding the side panel and then hiding it:
var sidepanel = crystalReportsViewer1.FindName("btnToggleSidePanel") as ToggleButton;
if (sidepanel != null) {
crystalReportsViewer1.ViewChange += (x, y) => sidepanel.IsChecked = false;
}
adding this namespace:
using System.Windows.Controls.Primitives;
The problem was that the WPF ReportViewer is slightly diferent to the Win Forms one, some properties (such as ToolPanelView and ShowGroupTreeButton) have been removed, I tried many different things but the above was the only that did the trick.
You can change it from the designer by changing the 'ToolPanelView' to 'None' and hide the button by changing 'ShowGroupTreeButton' to 'false'. Previous versions had a method to explicitly hide the group tree but I believe it's been deprecated in the version you are using. To change the properties in code behind:
crystalreportviewer.ToolPanelView = TooPanelViewType.None;
crystalreportviewer.ShowGroupTreeButton = false;
there is a property DisplayGroupTree . and you can avoid the free space by using this code
CrystalReportViewer1.DisplayGroupTree = false;
CrystalReportViewer1.HasToggleGroupTreeButton = false;
Use the command to hide the panel.
CrystalReportViewer1.ToolPanelView = CrystalDecisions.Windows.Forms.ToolPanelViewType.None
I ran into the same issue as Crystal Report changes the convention. In older version of the Crystal report would hide the button and not show the panel on the left hand side. CrystalReportViewer1.ShowGroupTreeButton = False
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With