StiSLViewerControl CurrentPageChanged Event not called

Stimulsoft Reports.Silverlight discussion
Locked
GraemeGarrett
Posts: 2
Joined: Tue Nov 02, 2010 4:15 am
Location: UK

StiSLViewerControl CurrentPageChanged Event not called

Post by GraemeGarrett »

Hi Guys,

Using the .Ultimate 2011.3 version, am trying to implement a customised report viewer with very limited functionality exposed to our users, so all the inbuilt toolbars etc are turned off. I have our own button controls to provide First, Previous, Next and Last Page functionality and have these hooked up to commands. In the CommandCanExecute events have tried referring to the Report.IsFirstPage and Report.IsLastPage properties but could not get this method to work, .IsFirstPage always seems to return 'true' and .IsLastPage generates a Null Reference Exception.

As a work around tried to control the enabling of these commands from the Report.CurrentPageChanged event as have been able to do successfully in another WPF project, but this event does not appear to be called.

Before spending more time investigating this, has anyone else seen similar issues with this event?

Any pointers would be appreciated.

Thanks
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

StiSLViewerControl CurrentPageChanged Event not called

Post by HighAley »

Hello.
GraemeGarrett wrote:Using the .Ultimate 2011.3 version, am trying to implement a customised report viewer with very limited functionality exposed to our users, so all the inbuilt toolbars etc are turned off. I have our own button controls to provide First, Previous, Next and Last Page functionality and have these hooked up to commands. In the CommandCanExecute events have tried referring to the Report.IsFirstPage and Report.IsLastPage properties but could not get this method to work, .IsFirstPage always seems to return 'true' and .IsLastPage generates a Null Reference Exception.

As a work around tried to control the enabling of these commands from the Report.CurrentPageChanged event as have been able to do successfully in another WPF project, but this event does not appear to be called.

Before spending more time investigating this, has anyone else seen similar issues with this event?

Any pointers would be appreciated.
You should subscribe on RefreshControlState event in StiSLViewerControl and use next code:

Code: Select all

bool isCurrentReportNull = this.CurrentReport != null;
buttonPageFirst.IsEnabled = isCurrentReportNull && this.CurrentReport.RenderedPages.Count > 1 && this.CurrentPrintPage > 0;
buttonPagePrevious.IsEnabled = isCurrentReportNull && this.CurrentReport.RenderedPages.Count > 1 && this.CurrentPrintPage > 0;
buttonPageGoTo.IsEnabled = isCurrentReportNull;
buttonPageNext.IsEnabled = isCurrentReportNull && this.CurrentReport.RenderedPages.Count > 1 && this.CurrentPrintPage  1 && this.CurrentPrintPage < this.CurrentReport.RenderedPages.Count - 1;
Thank you.
Locked