c# - UWP - How to prevent InputPane from showing and hiding automatically -


i want manually control behavior of inputpane prevent showing or hiding automatically.

enter image description here

in page put image top, want inputpane show user navigate page , keep showing until he/she clicks on specified button , prevent hiding if user clicks anywhere else in page.

also want inputpane remain hidden if user clicks on textbox.

i know there tryshow() , tryhide(), can't revent auto showing , hiding.

the easy way control controlling focus of textbox. if set istabstop on textbox false - won't take focus , sip won't show up. if has focus - you'll need move out. if want display sip - focus textbox. note performance reasons , prevent user confusion - might make sense use textblock instead of textbox when control should not editable.

xaml

<page     x:class="app18.mainpage"     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     xmlns:local="using:app18"     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"     mc:ignorable="d">      <grid         background="{themeresource applicationpagebackgroundthemebrush}">         <grid.rowdefinitions>             <rowdefinition />             <rowdefinition                 height="auto" />         </grid.rowdefinitions>         <textbox             x:name="mytextbox"             istabstop="false"             acceptsreturn="true"             verticalalignment="stretch"             textchanged="mytextbox_ontextchanged"/>         <button             x:name="mybutton"             grid.row="1"             click="buttonbase_onclick">edit</button>     </grid> </page> 

c#

using windows.ui.xaml; using windows.ui.xaml.controls;  namespace app18 {     public sealed partial class mainpage : page     {         public mainpage()         {             this.initializecomponent();         }          private void buttonbase_onclick(object sender, routedeventargs e)         {             mytextbox.istabstop = true;             mytextbox.focus(focusstate.programmatic);         }          private void mytextbox_ontextchanged(object sender, textchangedeventargs e)         {             if (mytextbox.text.tolower().contains("done"))             {                 mytextbox.istabstop = false;                 mybutton.focus(focusstate.programmatic);             }         }     } } 

Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -