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 will learn about sync provider notifications in Windows 11 and how to disable or enable it...
In this tutorial, let’s learn how to enable or disable the startup sound in Windows 11. By default, when Windows...
The CameraCaptureTask allows the Windows Phone 7 App to launch the Camera Application . This will be useful when the...