Search code examples
wpfcrystal-reports

How to hide the Group Tree of a Crystal Report in WPF?


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.


Solution

  • 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.