I was wondering if it would be possible to intercept hyperlink clicks in the WpfReportViewer and cancel them?
I have hyperlinks (http://localhost:8080/navigate?area=foo) in a report that will navigate the app the viewer is hosted in.
This currently works however the user experience is not very good. If a browser window is not open one opens, in addition a script used to close the window requires a user to ack a dialog in some browsers to close it. For these reasons I was wondering if I could preview the clicks and cancel them.
Thanks,
Craig
Intercept hyperlink clicks
Re: Intercept hyperlink clicks
Hello.
Could you send us your report template with data which demonstrate the issue and describe your problem more detailed.
Where these hyperlinks are? How will you navigate your app?
Thank you.
Could you send us your report template with data which demonstrate the issue and describe your problem more detailed.
Where these hyperlinks are? How will you navigate your app?
Thank you.
Re: Intercept hyperlink clicks
Hi Aleksey,
I'm not sure my report template will be all that usefull to you. My report contains a Text field that has the hyperlink interaction set to a URI such as (http://localhost:8083:/ViewName?Params).
When the hyperlink is clicked as you would expect the report viewer opens the computers default browser and navigates to this url. My app is running a local webserver when when it receives this request it sees it as a request to open a specific view thru our window manager. The responce sent to the browser is a small script to close the browser window. As explained about this works but is not a desirable user experiance.
What would be nice is if the WpfReportView had a PreviewHyperlinkClick event. As with other .Net event handlers I would have the ability to cancel the event and handle it myself as well as have access to the URI that is being clicked. The pseudo code below is an example of what I would like todo. This would allow me to by pass using the webrowser to get the navigate request into my app. But would still allow exported reports being viewed to navigate the app thru the web browser.
WPFReportView.PreviewHyperLInkClick += PreViewHyperlinkClickHandler;
void PreViewHyperlinkClickHandler(object sender, HyperlinkClickArgs hyperlinkClickArgs) {
//This would prevent the WPFReportViewer from making an actual web request.
hyperlinkClickArgs.Cancel = true;
//I would have access to the URI being clicked so I could perform my own action.
myWindowManger.Navigate(hyperlinkClickArgs.Uri);
}
Thanks,
Craig.
I'm not sure my report template will be all that usefull to you. My report contains a Text field that has the hyperlink interaction set to a URI such as (http://localhost:8083:/ViewName?Params).
When the hyperlink is clicked as you would expect the report viewer opens the computers default browser and navigates to this url. My app is running a local webserver when when it receives this request it sees it as a request to open a specific view thru our window manager. The responce sent to the browser is a small script to close the browser window. As explained about this works but is not a desirable user experiance.
What would be nice is if the WpfReportView had a PreviewHyperlinkClick event. As with other .Net event handlers I would have the ability to cancel the event and handle it myself as well as have access to the URI that is being clicked. The pseudo code below is an example of what I would like todo. This would allow me to by pass using the webrowser to get the navigate request into my app. But would still allow exported reports being viewed to navigate the app thru the web browser.
WPFReportView.PreviewHyperLInkClick += PreViewHyperlinkClickHandler;
void PreViewHyperlinkClickHandler(object sender, HyperlinkClickArgs hyperlinkClickArgs) {
//This would prevent the WPFReportViewer from making an actual web request.
hyperlinkClickArgs.Cancel = true;
//I would have access to the URI being clicked so I could perform my own action.
myWindowManger.Navigate(hyperlinkClickArgs.Uri);
}
Thanks,
Craig.
Re: Intercept hyperlink clicks
Hello.
What stops you from using Click event of the Text box? You could handle clicking on the text and no browser will be shown.
Thank you.
What stops you from using Click event of the Text box? You could handle clicking on the text and no browser will be shown.
Thank you.
Re: Intercept hyperlink clicks
Hi Aleksey,
Hooking up to the ClickComponent event will get half of what I need. I can intercept the click and get access to the URI thru the StiCompenent.HyperlinkValue property. But how can I now prevent the StiReportViewerControl from making an actual web request?
I tried hooking up to the PreviewMouseDown event which will allow me to cancel it, but I was unable to figure out how to find the actual textbox that was clicked. The original source for the event is a tooltip.
Thanks,
Craig.
Hooking up to the ClickComponent event will get half of what I need. I can intercept the click and get access to the URI thru the StiCompenent.HyperlinkValue property. But how can I now prevent the StiReportViewerControl from making an actual web request?
I tried hooking up to the PreviewMouseDown event which will allow me to cancel it, but I was unable to figure out how to find the actual textbox that was clicked. The original source for the event is a tooltip.
Thanks,
Craig.
Re: Intercept hyperlink clicks
Hello.
Thank you.
Please, try to use Tag property instead of the Hyperlink property.croffers wrote:Hooking up to the ClickComponent event will get half of what I need. I can intercept the click and get access to the URI thru the StiCompenent.HyperlinkValue property. But how can I now prevent the StiReportViewerControl from making an actual web request?
I tried hooking up to the PreviewMouseDown event which will allow me to cancel it, but I was unable to figure out how to find the actual textbox that was clicked. The original source for the event is a tooltip.
Thank you.