user3560627
user3560627

Reputation: 59

how open flyout on textbox get focus?using uwp

I am new in uwp.i have to create calculator using flyout feature.

how to open flyout below the textbox on textbox got focus.

Upvotes: 2

Views: 2727

Answers (2)

Jay P
Jay P

Reputation: 11

Try this out:

GotFocus="TextBlock_Tapped"

Upvotes: 1

Matthias Herrmann
Matthias Herrmann

Reputation: 2790

I used TextBlock instead of Textbox, but you can change that:

<TextBlock Text="Textblock with MenuFlyout" Height="20" Tapped="TextBlock_Tapped" x:Name="MyTextBlock">
    <FlyoutBase.AttachedFlyout>
        <MenuFlyout x:Name="Flyout">
            <MenuFlyout.Items>
                <MenuFlyoutItem>
                    Click Me
                </MenuFlyoutItem>
            </MenuFlyout.Items>
        </MenuFlyout>
    </FlyoutBase.AttachedFlyout>
</TextBlock>

The Code behind the TextBlock_Tapped event:

private void TextBlock_Tapped(object sender, TappedRoutedEventArgs e)
{
    Flyout.ShowAt(MyTextBlock);
}

Upvotes: 1

Related Questions