Automatic text completion in AutoCompleteBox in Windows Phone

You can change this behaviour slightly such that the first possible suggested word / sentence is filled in the AutoCompleteBox .

To do that Just set the IsTextCompletionEnabled property of the AutoCompleteBox to True.

Automatic text completion in AutoCompleteBox in Windows Phone

public partial class MainPage : PhoneApplicationPage

{

// Constructor

public MainPage()

{

InitializeComponent();

AddAutocomplete();

}

public void AddAutocomplete()

{

AutoCompleteBox txtbox = new AutoCompleteBox();

txtbox.IsTextCompletionEnabled = true;

stack.Children.Add(txtbox);

// Data

txtbox.ItemsSource = GetSports();

}

public List<string> GetSports()

{

List<string> Sports = new List<string>();

Sports.Add("Cricket - One Day");

Sports.Add("Cricket - Test");

Sports.Add("Tennis");

Sports.Add("Table Tennis");

Sports.Add("Hockey");

Sports.Add("Football");

return Sports;

}

}

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

In this post, you’ll learn about the Win32 Error “0x000019E5 – ERROR_COULD_NOT_RESIZE_LOG” that you get when debugging system erors in...
In this post, you’ll learn about the error “CO_E_DBERROR 0x8004E02B” that is returned when working with COM based APIs or...
In this post, you’ll learn about the Win32 Error “0x000019D0 – ERROR_LOG_BLOCK_VERSION” that you get when debugging system erors in...