开发者

Best way to create a popup replacement in WP7

I'm开发者_Go百科 using the popup control in wp7 as a modal dialog to edit grid rows. The performance is dreadful - it can take up to 5 seconds to open - and I'm looking for an alternative. I'm also aware that I will have problems further down the road when I try and support landscape.

My grid control (think datagrid) that open the popup is a user control that can appear anywhere on any page. I tried embedding a hidden grid inside it that resizes to 480 x 800 but can't seem to make it appear any higher up the page than the grid.

I don't want to put a hidden grid on every page just in case.

Is there a better way? Surely someone must have done this sort of thing before.


I tried all the alternatives but ended up using the hidden grid approach.

I created a base class which looks for a named grid on the page, adds itself to the Children property and makes it visible.

It is simple, effective and supports all orientations.


I've used ChildWindow from the main Silverlight 3 framework, following instructions from: http://wildermuth.com/2010/08/17/Using_ChildWindow_in_Windows_Phone_7_Projects

If you don't like the childwindow styling, then you can edit the resources - e.g. in RunSat my popup is actually just light text on a dark grey semi-transparent background.


I think you should implement a new PhoneApplicationPage, and code it as a "modal form".

This because, in any case, you have to spend some time writing code:

  • ChildWindows are not phone-styled (they are graphically different from the rest of the GUI)...the worst solution...
  • Any class deriving from Popup (it's an abstract class) needs to be customized, and it's not rendered by the WP rendering thread. So...not a good solution, as you have seen.

By using the OnNavigateTo/OnNavigateFrom events, you can easily store and trace the results (also collections, fields, classes, ..) in a simple "sharing" class (maybe linked to App class = you always have a simple way to reference it)...and you also all the powerful tools for a complete interface. And, obviously, non problems with performance!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜