c# - How to show a full screen Modal ContentDialog in Windows Phone 8.1 -
when user trying login app, displaying contentdialog containing few textblocks , progressbar.
i take contentdialog because modal , blocks user until application collects required info , ready navigate next page.
the next link shows content dialog class available windows phone 8.1(universal apps).
the next code displays code-behind have written display contentdialog (i have temporarily set in onnavigatedto testing, later move appropriate notification function)
//progress bar progressbar bar = new progressbar(); bar.isindeterminate = true; //downloading info text textblock txt = new textblock(); txt.text = "downloading data..."; txt.fontsize = 17; txt.foreground = new solidcolorbrush(colors.white); txt.horizontalalignment = windows.ui.xaml.horizontalalignment.center; //this take few seconds textblock txt2 = new textblock(); txt2.text = "this take few seconds."; txt2.fontsize = 17; txt2.foreground = new solidcolorbrush(colors.white); txt2.horizontalalignment = windows.ui.xaml.horizontalalignment.center; //please not close application. textblock txt3 = new textblock(); txt3.text = "please not close application."; txt3.fontsize = 17; txt3.foreground = new solidcolorbrush(colors.white); txt3.horizontalalignment = windows.ui.xaml.horizontalalignment.center; stackpanel stk = new stackpanel(); stk.children.add(bar); stk.children.add(txt); stk.children.add(txt2); stk.children.add(txt3); contentdialog dlg = new contentdialog(); dlg.content = stk; solidcolorbrush color = new solidcolorbrush(colors.black); color.opacity = 0.7; dlg.background = color; dlg.margin = new thickness(0, 250, 0, 0); dlg.showasync(); this displayed above can see covering part of background
i want displayed
by making total screen modal.
i have tried changing height , other properties unable work.
i glad if can point me in right direction.
i found solution eliminates code behind. not sure if more of work around. allows me utilize binding decide when display modal dialog , when hide it.
this xaml
<grid> <grid visibility="{binding isdownloadingdata}" canvas.zindex="1" background="{staticresource partiallytransparentblackcolor}" horizontalalignment="stretch"> <grid.rowdefinitions> <rowdefinition height="*" /> <rowdefinition height="auto" /> <rowdefinition height="auto" /> <rowdefinition height="auto" /> <rowdefinition height="auto" /> <rowdefinition height="*" /> </grid.rowdefinitions> <progressbar grid.row="1" isindeterminate="true"/> <textblock grid.row="2" text="downloading data..." fontsize="17" foreground="white" horizontalalignment="center"/> <textblock grid.row="3" text="this take few seconds." fontsize="17" foreground="white" horizontalalignment="center"/> <textblock grid.row="4" text="please not close application." fontsize="17" foreground="white" horizontalalignment="center"/> </grid> <scrollviewer canvas.zindex="0" verticalalignment="stretch" margin="0,10,0,10"> <!-- xaml should hidden goes here (in case login page xaml) --> </scrollviewer> i play around visibility of grid has canvas.zindex="1" using binding , decide when display modal window.
c# windows-phone-8.1 win-universal-app
No comments:
Post a Comment