Click here to Skip to main content
12,945,066 members (67,027 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


Posted 7 Jun 2011

Hide Report Group Tree in WPF

, 7 Jun 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
Hiding ReportGroupTree in WPF is a little bit tricky, as there is no simple property or method to do this.

Hiding ReportGroupTree in WPF is a little bit tricky, as there is no simple property or method to do this.


In WinForms we have a property DisplayGroupTree to hide ReportGroupTree but in WPF I checked for this property DisplayGroupTree but all in vain.
Using the code

First of all, I used CrystalReportViewer in WindowsFormsHost:
   <crystal:CrystalReportViewer x:Name="rptViewer" />

and then I added a property in code behind:
public bool ShowGroupTree
          System.Windows.Forms.Control control = null;
          for (int i = 0; i < m_Viewer.Controls.Count; i++)
              control = rptViewer.Controls[i];
              if (control is ReportGroupTree)
               {  //Hide the Group tree by default.
                   control.Visible = value;

Now we just need to call this property i.e. ShowGroupTree, where to hide the ReportGroupTree.

Points of Interest
<code>System.Windows.Forms.Control control = null;</code> 

This control variable must be of System.Windows.Forms.Control type, otherwise it will throw Exception, as rptViewer.Controls[i] will is not of System.Windows.Controls.Control type.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Kanwal Shehzad
Software Developer (Senior) Al Kaffary
Saudi Arabia Saudi Arabia
I am Computer Science graduate and working in Microsoft technologies (VB.Net/C#, ASP.Net, WPF, WCF, SQL Server 2005/2008, Web Services).

You may also be interested in...

Comments and Discussions

GeneralReason for my vote of 5 Good work Pin
Toniyo Jackson7-Jun-11 1:48
memberToniyo Jackson7-Jun-11 1:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170518.1 | Last Updated 7 Jun 2011
Article Copyright 2011 by Kanwal Shehzad
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid