How to allow typing in a textbox in a flyout from an AppBarButton?

帕菲菲 141 Reputation points
2021-07-20T06:57:37.947+00:00
<Page.BottomAppBar>
 <CommandBar IsOpen="True" IsSticky="True">
 <AppBarButton x:Name="新建文件" Icon="NewWindow" Label="新建文件">
 <AppBarButton.Flyout>
 <Flyout AllowFocusOnInteraction="True">
 <StackPanel>
 <TextBox x:Name="保存扩展名" Header="输入文件扩展名"/>

The textbox does not allow user input from the keyboard. Why?
@wolfSYS I saw your post about this issue. Have you solved it?

Developer technologies | Universal Windows Platform (UWP)
0 comments No comments
{count} votes

Accepted answer
  1. Anonymous
    2021-07-20T08:57:45.057+00:00

    Hello,

    Welcome to Microsoft Q&A!

    The textbox does not allow user input from the keyboard. Why?

    Please enable set AllowFocusOnInteraction property to true on the AppBarButton instead of the Flyout.

    Like this:

    <Page.BottomAppBar>  
            <CommandBar IsOpen="True" IsSticky="True">  
                <AppBarButton x:Name="新建文件" Icon="NewWindow" Label="新建文件" AllowFocusOnInteraction="True">  
                    <AppBarButton.Flyout>  
    

    This behavior is a side effect of the new focus system which allows users to interact with controls such as AppBarButtons without stealing the focus from the control they're trying to modify. This has been a huge request from devs whose apps have scenarios such as text editors: the app can have formatting buttons (e.g. bold, italic, colors) which change the formatting without affecting the text's focus or selection.

    You could check this document for more information: ComboBox on a Flyout attached to an AppBarButton loses mouse input on 1607.

    Thank you.


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.