c# - IsLightDismissEnabled="True" is not actually dismissing the popup -
i have pop , want close when tap anywhere outside pop up. searched , advised me use property islightdismissenabled; if touch outside, remove pop oup leaving inactive grey screen if doesnt close pop code snippet:
<popup x:name="logincontroler" isopen="false" margin="0,190,896,276" islightdismissenabled="true"> <stackpanel height="300" width="470" x:name="popup" flowdirection="righttoleft"> <grid width="470" background="white" > <grid.rowdefinitions> <rowdefinition height="70"/> <rowdefinition height="*"/> </grid.rowdefinitions> <richeditbox grid.row="1" height="250" textwrapping="wrap" fontsize="20" name="notespopuptextbox" flowdirection="lefttoright"/> <stackpanel grid.row="0" orientation="horizontal" background="#ffe3e3e5"> <button name="canclepopupbutton" content="cancel" width="64" height="64" click="canclepopupbutton_click" /> <button name="clearnotepopupbutton" content="clear" width="64" height="64" click="clearnotepopupbutton_click" /> <button name="savenotebutton" content="save" width="64" height="64" click="savenotebutton_click" /> <textblock fontweight="medium" fontsize="40" foreground="#2a2a86" margin="170 12 0 0">note</textblock> </stackpanel> </grid> </stackpanel> </popup>
this code events
private void showbutton_click(object sender, routedeventargs e) { logincontroler.isopen = true; flipview1.isenabled = false; } private void canclepopupbutton_click(object sender, routedeventargs e) { logincontroler.isopen = false; flipview1.isenabled = true; }
am missing anything? thank in advance
are sure don't have other code in app not showing us?
there should no gray box behind popup.
have tested code on empty windows 8.1 (xaml+c#) app , works fine.
try creating , blank windows 8.1 app , make mainpage this:
mainpage.xaml
<page x:class="app19.mainpage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:app19" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:ignorable="d" requestedtheme="light"> <grid background="{themeresource applicationpagebackgroundthemebrush}"> <popup x:name="logincontroler" isopen="false" margin="0,190,896,276" islightdismissenabled="true"> <stackpanel height="320" width="470" x:name="popup" flowdirection="righttoleft"> <grid width="470" background="burlywood" > <grid.rowdefinitions> <rowdefinition height="70"/> <rowdefinition height="*"/> </grid.rowdefinitions> <richeditbox grid.row="1" height="250" textwrapping="wrap" fontsize="20" name="notespopuptextbox" flowdirection="lefttoright"/> <stackpanel grid.row="0" orientation="horizontal" background="#ffe3e3e5"> <button name="canclepopupbutton" content="cancel" width="64" height="64" /> <button name="clearnotepopupbutton" content="clear" width="64" height="64" /> <button name="savenotebutton" content="save" width="64" height="64" /> <textblock fontweight="medium" fontsize="40" foreground="#2a2a86" margin="170 12 0 0">note</textblock> </stackpanel> </grid> </stackpanel> </popup> <button content="show popup" horizontalalignment="left" margin="692,260,0,0" verticalalignment="top" click="showbutton_click"/> </grid> </page>
mainpage.xaml.cs
using windows.ui.xaml; using windows.ui.xaml.controls; namespace app19 { /// <summary> /// empty page can used on own or navigated within frame. /// </summary> public sealed partial class mainpage : page { public mainpage() { this.initializecomponent(); } private void showbutton_click(object sender, routedeventargs e) { logincontroler.isopen = true; } } }
this has work.
, comparing solution should find problem. if not, edit question more information. (more code)
note: removed click events popup, not needed exemplify problem, right?
Comments
Post a Comment