joyrider

The scenario is, I got a mouse event, retrieved its position relative to the DockPanel (which is the main client area in my application). When I tried to call DockPanel.PointToScreen() to convert the position into screen coordinate space, I got an security exception.

From the exception message, it looks like the PointToScreen() call will reference certain component related to office solution, and Xbap's partially trusted level is not sufficient to call thoses components.

However, getting a mouse position in screen coordinate space sometimes is needed in Xbap. Is there any alternative way to achieve this with Xbap's limited trust level



Re: Windows Presentation Foundation (WPF) Calling PointToScreen() of DockPanel in xbap ran into security exception

Chango V. - MSFT

Can you describe what you need to accomplish on a higher level Why do you need screen coordinates






Re: Windows Presentation Foundation (WPF) Calling PointToScreen() of DockPanel in xbap ran into security exception

joyrider

I am building some new libraries to replace the old ones, and I have to follow the same API that the old libraries used. The screen coordinates were required in the API.




Re: Windows Presentation Foundation (WPF) Calling PointToScreen() of DockPanel in xbap ran into security exception

Tim Dawson

Then you have chosen an inappropriate solution. There's no need for an XBAP to know about screen coordinates, so it cannot obtain them.






Re: Windows Presentation Foundation (WPF) Calling PointToScreen() of DockPanel in xbap ran into security exception

joyrider

Thanks. A definite negative answer is an answer too.





Re: Windows Presentation Foundation (WPF) Calling PointToScreen() of DockPanel in xbap ran into security exception

Chango V. - MSFT

If your XBAP is somehow "unusual" and if it doesn't need to be deployed from the Internet but is intended only for local use, then you may consider converting it to a Full Trust one.






Re: Windows Presentation Foundation (WPF) Calling PointToScreen() of DockPanel in xbap ran into security exception

joyrider

Good idea, but my application is not limited for local use only. I think I might need to examine the API and make some compromise to avoid the screen coordinates.

Thanks.