RadComboBox SelectAllTextEvent

2 posts, 0 answers
  1. Jonah
    Jonah avatar
    29 posts
    Member since:
    Oct 2012

    Posted 09 Jul 2014 Link to this post

    When I set the select all text event on the combobox, when I click into the combobox it selects all the text then goes away. If I tab into the combobox everything stays selected. Am I missing something? Below is my xaml

    ​<telerik:RadComboBox ItemsSource="{Binding OptionCategories}" DisplayMemberPath="CategoryName" Grid.Row="1" IsEnabled="{Binding CanChangeOption}"
    Margin="10 0" IsEditable="True" SelectedIndex="0" VerticalAlignment="Center" SelectedItem="{Binding SelectedOptionCategory}" SelectAllTextEvent="GotFocus" />
  2. Rosen Vladimirov
    Rosen Vladimirov avatar
    640 posts

    Posted 11 Jul 2014 Link to this post

    Hello Jonah,

    This is a known issue and you can track its status in our feedback portal. It looks like the problem is related to the TextBox, which is inside the Editable's RadComboBox template. We just call its SelectAll method, but it looks like there is some problem in WPF and SelectAll is invoked before Mouse events and the selection is lost. As a workaround you may handle GotFocus event of RadComboBox and call SelectAll of the Text via Dispatcher:
    private void RadComboBox_GotFocus(object sender, RoutedEventArgs e)
        var comboBox = sender as RadComboBox;
        if (comboBox != null)
            var textBox = comboBox.Template.FindName("PART_EditableTextBox", comboBox) as TextBox;
            if (textBox != null)
                Dispatcher.BeginInvoke(new Action(() => textBox.SelectAll()));

    Hope this helps.

    Rosen Vladimirov
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
Back to Top