Center the Silverlight popup on a canvas that is larger than the screen

I currently have a Silverlight canvas that is larger than the visible area of ​​the screen (I allow users to move visible areas around to move). I am trying to show a modal popup that always appears in the middle of the viewport, and I cannot find any property that tells me what is currently on the screen. Basically, if a user turns down and clicks something that causes a modal popup to appear, it is stuck at the top of the screen.

Any ideas anybody?

Thanks ~ Steve

+4
source share
3 answers

I do not think this is possible, since visibility does not pop up. Perhaps with some JavaScript pleasure, to find out where the pan is located?

+1
source

That's right. I started creating canvas canvas, making it fullscreen, and set everything else as a child’s canvas in this one. A modal popup now appears in the canvas.

0
source

Gabriel Guimaraes works well.

App.Current.Host.Content.ActualHeight (and ActualWidth) really increases the size of the browser. Good for calculating position. And of course, you can use LayoutUpdated for your main control to double-check and resize if necessary.

0
source

All Articles