Posted 3 August 2023, 7:07 pm EST
I’m the process of upgrading from ActiveReports7 to ActiveReports17 an old codebase.
So far, it’s being pretty much a plug-and-play experience. I have an issue on my build server (I’ve made a separate post here: https://www.grapecity.com/forums/activereports/activereports-licensing-on-a-build-server#69415 ) but from the code and compatibility perspective I have just one piece of code that doesn’t work anymore, related to the colorization of my TOC.
In the previous iteration, I had a little dirty piece of code gaining access to underlying treeview:
//example from: http://arhelp.grapecity.com/groups/topic/default-table-of-contents-to-collapsed/
TocView tocView = null;
var controls = _viewer.Controls.Find("SidebarView", true);
var sidebarView = controls[0] as SidebarView;
controls = sidebarView.Controls.Find("ContentPanel", true);
var contentPanel = controls[0];
foreach (Control control in contentPanel.Controls)
{
if (((SidebarTabs)control.Tag) == SidebarTabs.Toc)
tocView = ((TocView)control);
}
after getting the TocView object I was able to iterate on the nodes and call a method to paint the nodes in different colors under some circumstances.
foreach (TreeNode node in tocView.Nodes)
{
this.ColorizeTocRecursive(node);
}
I still have a reference to an old post in a comment, but it’s now a dead link.
TocView is now private, so I can’t access it anymore.
I’m probably missing an higher level API that’s being introduced in the latest years that should let me do the same process in a clearer way. If anyone has an hint on that that would be great.
Thanks in advance,
Matteo