Customize the Stimulsoft Reports WinRT ReportViewer control

The Stimulsoft Reports are great especially that they are the single reporting solution for WinRT ( at the moment ) so in order to remove the orange border and the report background I had to  use tools like Silverlight Spy or XAML Spy to have a look at the Visual Tree to identify the border and the Background Path and then make a method that will get that object and change it or remove it.

I do have my own visual tree helpers but I also found a good and simple solution that will help me get each visual element.

You can find more details on how this works from here .

I am guessing that you’ve already installed the Stimulsoft Reports.WinRT and that you already have the library’s that you need and have all the project setup , or you can have a look at this  video .

Now I used the XAML spy, took a look and so that my border is the second Border and the container that have the background is the first Grid.

private void RemoveBorderFromReport()
{
IEnumerable<Windows.UI.Xaml.Shapes.Path> paths = ViewerControl.GetVisuals().OfType<Windows.UI.Xaml.Shapes.Path>();
//remove background
if (paths != null)
{
paths.ElementAt(0).Data = null;
}
Border border = ViewerControl.GetVisuals().OfType<Border>().ElementAt(1);
 
if (border != null)
{
border.BorderThickness = newThickness(0);
}
if (border != null)
{
border.CornerRadius = newCornerRadius(0);
}
Grid grid = ViewerControl.GetVisuals().OfType<Grid>().ElementAt(0);
grid.Background = newLinearGradientBrush();
}
 
Before                                          After
                    
 
 Is a bit Hacky but is the only solution I know.
Happy codding!
Advertisements
  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: