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

Get the RadComboBox Text of an editable combobox

9 Answers 466 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
danparker276
Top achievements
Rank 2
danparker276 asked on 21 Feb 2012, 11:34 PM
UPDATE: This only happens when I'm setting the combobox to a Non Virtualizing Stack Panel and filter is enabled:
UPDATE: Version 2012.1.221.1050 and the other 2012 fail.  Version 2011.3.1413.1050 works.

I'm almost positive this used to work and a recent update has changed things.
When I tab out of an editable combo box, I want to get the text value in the combo box even if it isn't a selected item.

<telerik:RadComboBox x:Name="myCombo" OpenDropDownOnFocus="False" Margin="5 0 0 0"
        IsReadOnly="False" LostFocus="myCombo_LostFocus"
        SelectionChanged="myCombo_SelectionChanged"
        ClearSelectionButtonVisibility="Visible" ClearSelectionButtonContent="Clear"
        Width="80" IsEditable="True">


private void myCombo_LostFocus(object sender, RoutedEventArgs e)
{
    //I Don't get the correct
    string myText= (myCombo.Text ?? "").Trim();
    
}

When I go to the lost focus, there is nothing in the .Text even if I type something in the combobox.

UPDATE This is in my init:
public SilverlightControl1()
{
    InitializeComponent();
    this.rcMatterId.ItemsPanel = this.Resources["NotvirtualizingStackPanel"] as ItemsPanelTemplate;
    rcMatterId.IsFilteringEnabled = true;
}

UPDATE: This is in my xaml
<UserControl.Resources>
    <ItemsPanelTemplate x:Key="virtualizingStackPanel">
        <VirtualizingStackPanel />
    </ItemsPanelTemplate>
    <ItemsPanelTemplate x:Key="NotvirtualizingStackPanel">
    </ItemsPanelTemplate>
</UserControl.Resources>

This only fails to get the text value when the Update mentioned is set.  This is only in the new version of telerik controls.

9 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 27 Feb 2012, 12:50 PM
Hello Dan,

We've managed to reproduce this issue and we will investigate the reasons for it.  I will write here as soon as we have a result.

All the best,
Yana
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Yana
Telerik team
answered on 19 Apr 2012, 08:58 AM
Hello Dan,

We've logged this issue in our public issue tracking system, you can vote for it and track its progress here. We will do our best to fix it for the Q2 release or shortly after.

We are sorry for the caused inconvenience.

All the best,
Yana
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Oleg
Top achievements
Rank 1
answered on 17 Dec 2012, 11:32 AM
Hi there!

I have this issue with Telerik.Windows.Controls.DLL of version 2012.3.1017.1050. My RadComboBox loses its text i've entered after LostFocus, if it doesnt fit any item in the list.

Here is my xaml:

<telerik:RadComboBox Name="InputComboBox" CanKeyboardNavigationSelectItems="True" StaysOpenOnEdit="True"  Grid.Column="1" IsEditable="True" ItemsSource="{Binding PossibleEmailRecipients}"
                                             Margin="5" KeyDown="InputComboBoxKeyDown" Padding="5" FontFamily="{StaticResource ContentFontFamily}"
                                             CanAutocompleteSelectItems="True" OpenDropDownOnFocus="True"
                                             FontSize="{StaticResource SmallFontSize}" telerik:TextSearch.TextPath="SearchString" TextSearchMode="Contains">
                            <telerik:RadComboBox.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Horizontal">
                                        <ntcControls:Avatar PopupEnabled="False" DisplayMode="ExtraSmallWithName"  User="{Binding User}" Foreground="{StaticResource BlackBrush}" Margin="5,0,0,0" VerticalAlignment="Center" Visibility="{Binding User, Converter={StaticResource NullVisibleConverter}, ConverterParameter='invert'}"/>
                                        <TextBlock Foreground="{StaticResource BlackBrush}" Text="{Binding Email}" VerticalAlignment="Center" Margin="5,0,0,0" Visibility="{Binding User, Converter={StaticResource NullVisibleConverter}}"/>
                                    </StackPanel>
                                </DataTemplate>
                            </telerik:RadComboBox.ItemTemplate>
                        
                           
                        </telerik:RadComboBox>

In the InputComboBoxKeyDown event happens this:
if (e.Key == Key.Enter)
{
    TryAddRecipient();
}
0
Oleg
Top achievements
Rank 1
answered on 17 Dec 2012, 02:39 PM
Btw my question is - how can I prevent it and keep the text in the combobox?


0
Yana
Telerik team
answered on 19 Dec 2012, 03:04 PM
Hi Dan,

I am afraid that the ComboBox is designed in such a way that it does not preserve the text in this case (when filtering is enabled and the text does not match any item in the dropdown).

We're sorry for the inconvenience.

Regards,
Yana
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Oleg
Top achievements
Rank 1
answered on 21 Dec 2012, 10:38 AM
I am not Dan :D But it's okay :)))

In your samples there is a Combobox with the exactly the same item template structure as I need. And it works the way I need it - but I dont know what's different in there... What do you mean with "filtering"? Autocomplete function? How can I disable this filter stuff to make the combobox keep the text?
0
Oleg
Top achievements
Rank 1
answered on 21 Dec 2012, 10:41 AM
<telerik:RadComboBox IsFilteringEnabled="False" Name="InputComboBox" CanKeyboardNavigationSelectItems="True" StaysOpenOnEdit="True"  Grid.Column="1" IsEditable="True"
                                           ItemsSource="{Binding PossibleEmailRecipients}" Margin="5" KeyDown="InputComboBoxKeyDown" Padding="5" FontFamily="{StaticResource ContentFontFamily}"
                                           CanAutocompleteSelectItems="True" OpenDropDownOnFocus="True"
                                           FontSize="{StaticResource SmallFontSize}" telerik:TextSearch.TextPath="SearchString" TextSearchMode="Contains">

This is the xaml code of my combobox - Filter ist disabled. But it still doesnt work
0
Oleg
Top achievements
Rank 1
answered on 21 Dec 2012, 11:00 AM
I've found the problem. The behaviour is correct, if I remove this property:  TextSearchMode="Contains"

0
Yana
Telerik team
answered on 21 Dec 2012, 02:50 PM
Hi Oleg,

I am sorry for the mistake.

I am glad that you've managed to find a solution.

Kind regards,
Yana
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
ComboBox
Asked by
danparker276
Top achievements
Rank 2
Answers by
Yana
Telerik team
Oleg
Top achievements
Rank 1
Share this question
or