Reputation: 550
Is it possible to use Enter key to break lines in Silverlight's AutocompleteBox
? Currently my binded data contains new line characters and box displays it properly (grows vertically), however pressing the Enter key does not break the line. Is there any way to achieve behaviour similar to TextBox
with property AcceptsReturn
set to True
? Any examples or ideas? Cheers
Upvotes: 0
Views: 426
Reputation: 550
I've found a solution, posting in case someone else needed:
public class MultilineAutocompleteBox : AutoCompleteBox
{
protected override void OnKeyDown(KeyEventArgs e)
{
if (e.Key == Key.Enter)
this.Text = string.Format("{0}\n", this.Text);
base.OnKeyDown(e);
}
}
Upvotes: 1