Unplanned
Last Updated: 09 Aug 2016 12:23 by ADMIN
jen
Created on: 16 Sep 2014 17:28
Category: AutoCompleteBox
Type: Feature Request
2
AutoCompleteBox: MaxLength
Expose the Textbox's MaxLength property to limit text input on the RadAutoComplete SearchText Property
2 comments
ADMIN
Kalin
Posted on: 08 Oct 2014 14:32
Hi Jen,

Thanks for your feedback.

Currently you can easily achieve the desired by hooking to the Loaded event handler of the control, get the TextBox there and set the desired MaxLength as shown below:

private void OnLoaded(object sender, RoutedEventArgs e)
{
    Dispatcher.BeginInvoke(() =>
    {
        var textBox = (sender as RadAutoCompleteBox).ChildrenOfType<TextBox>().FirstOrDefault();
        if (textBox != null)
        {
            textBox.MaxLength = 4;
        }
    });
}

Regards,
Kalin
jen
Posted on: 24 Sep 2014 18:28
This control also does not expose the textbox.SelectionStart property. 
When trying to work around the maxlength issue, it is not possible to reset the cursor position to the end of the input.

RadAutoCompleteBox box = sender as RadAutoCompleteBox;
box.SearchText = box.SearchText.Substring(0, Math.Min(box.SearchText.Length, 100));
//cursor is now positioned at the front of the input