Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8406109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:00:49+00:00 2026-06-09T23:00:49+00:00

I want to implement auto-complete on a textbox in a Windows 8 UI /

  • 0

I want to implement auto-complete on a textbox in a Windows 8 UI / Metro UI app using C#/XAML.

At the moment, when the soft / touch keyboard shows, it obscures the auto-complete box. However, on the text box focus, Windows 8 automatically scrolls the entire view up and ensures the text box is in focus.

In reality, all I want is the view to scroll up a little more (in fact, by the height of the auto-complete box).

I realise I can intercept the Showing event of InputPane.GetForCurrentView()

I can set InputPaneVisibilityEventArgs.EnsuredFocusedElementInView to true inside the Showing event fine (so Windows won’t try to do anything)…. however, how can I invoke the same scrolling functionality that Windows 8 would do, but ask it to scroll a little more!?

Here’s the code for the main page:

    <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
    <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,200,0,0">
        <TextBlock HorizontalAlignment="Center" FontSize="60">App 1</TextBlock>
        <TextBlock HorizontalAlignment="Center">Enter text below</TextBlock>
        <TextBox HorizontalAlignment="Center" Margin="-10,0,10,0" Width="400" Height="30"/>
        <ListBox HorizontalAlignment="Center" Width="400">
            <ListBoxItem>Auto complete item 1</ListBoxItem>
            <ListBoxItem>Auto complete item 2</ListBoxItem>
            <ListBoxItem>Auto complete item 3</ListBoxItem>
            <ListBoxItem>Auto complete item 4</ListBoxItem>
            <ListBoxItem>Auto complete item 5</ListBoxItem>
        </ListBox>
    </StackPanel>
</Grid>

If you start up the simulator with the lowest resolution, use the hand to “touch” the textbox, this will bring up the soft keyboard. In the real app, the auto complete list will appear with items as the user enters text.

So in a nutshell, how can I move the screen up a bit more so the user can see the entire autocomplete list?

Bear in mind, in the real app, it’ll be worse, as the user may not even notice the autocomplete list appearing “underneath” the keyboard.

I really would appreciate some advice, many thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T23:00:50+00:00Added an answer on June 9, 2026 at 11:00 pm

    Ok, here is how I would tackle this since I cannot seem to find any way to control the scrolling of the app based on the appearance of the keyboard. I would create a user control that would form the basis for the auto-complete textbox.

    <UserControl
    x:Class="App6.MyUserControl1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:App6"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300"
    d:DesignWidth="400">
    
    <Grid>
        <TextBox x:Name="textBox" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top"  GotFocus="textBox_GotFocus" LostFocus="textBox_LostFocus" />
        <ListBox x:Name="listBox" Height="150"  Margin="0,-150,0,0" VerticalAlignment="Top" Visibility="Collapsed"/>
    </Grid>
    

    This is an incredibly basic implementation, so you will have to tweak to meet your needs.

    Then, I would add the following code-behind to the user control

    public sealed partial class MyUserControl1 : UserControl
    {
        // Rect occludedRect;
        bool hasFocus = false;
    
        public MyUserControl1()
        {
            this.InitializeComponent();
            InputPane.GetForCurrentView().Showing += MyUserControl1_Showing;
        }
    
        void MyUserControl1_Showing(InputPane sender, InputPaneVisibilityEventArgs args)
        {
            if (hasFocus)
            {
                var occludedRect = args.OccludedRect;
    
                var element = textBox.TransformToVisual(null);
                var point = element.TransformPoint(new Point(0, 0));
    
                if (occludedRect.Top < point.Y + textBox.ActualHeight + listBox.ActualHeight)
                {
                    listBox.Margin = new Thickness(0, -listBox.ActualHeight, 0, 0);         // Draw above     
                }
                else
                {
                    listBox.Margin = new Thickness(0, textBox.ActualHeight, 0, 0); // draw below
                }
            }          
        }
    
        private void textBox_GotFocus(object sender, RoutedEventArgs e)
        {
            listBox.Visibility = Windows.UI.Xaml.Visibility.Visible;
            hasFocus = true;
        }
    
        private void textBox_LostFocus(object sender, RoutedEventArgs e)
        {
            listBox.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            hasFocus = false;
        }        
    }
    

    Next steps would be to expose properties to pass data to be bound to the ListBox. Hard core would be ListBoxItem templating and more, depending on how reusable you wanted it to be.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to implement auto complete feature in a rails application. I am using
I want to implement a 'Search with Auto complete drop down' but I don't
I want to implement a job scheduler in my windows azure application. My aim
My requirement is to implement auto complete in my text box with my rails
I've an AIR app that I'd like to implement a auto-save functionality. Currently I
I am trying to implement auto complete via jquery auto complete plugin. I have
I want to implement Username auto suggestion while Registration like Gamil or Yahoo is
How would one implement a custom auto-complete pop-up menu like Xcode has? At the
I want to generate a comma separated auto complete list in my rails application.With
I want to implement an autocomplete feature with images in my website. I would

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.