This is a migrated thread and some comments may be shown as answers.

RadComboBox SelectAllTextEvent

1 Answer 160 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Jonah
Top achievements
Rank 1
Jonah asked on 09 Jul 2014, 04:39 PM
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" />

1 Answer, 1 is accepted

Sort by
0
Rosen Vladimirov
Telerik team
answered on 11 Jul 2014, 08:05 AM
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.

Regards,
Rosen Vladimirov
Telerik
 
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.
 
Tags
ComboBox
Asked by
Jonah
Top achievements
Rank 1
Answers by
Rosen Vladimirov
Telerik team
Share this question
or