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

Strange behavior of backspace key in RadComboBox

0 Answers 133 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Quentin
Top achievements
Rank 1
Quentin asked on 21 Nov 2017, 06:22 PM

Hello,

I know there are already a couple of threads about backspace with RadComboBox but I can't find something specific enough to solve my problem. Let me explain it. I have two RadComboBox in two different screens of my app with different behaviors even though they seem to have the same properties. I used the debug mode to capture and compare every property of my comboboxes.

In the first screen when I hit the backspace button, the content of my combobox is removed while in the second screen it remains when I hit that button. The differences I noticed with the debug mode using a SelectionChanged event :

- Behavior 1 : In my first screen, after I hit backspace, SelectedIndex is set to -1, SelectedValue is set to null, SelectedItem is set to null and SelectionItemBox is set to null.

- Behavior 2 : In my second screen, after I hit backspace, SelectedIndex is set to -1, SelectedValue is set to null but SelectedItem and SelectionItemBox keep their values so the view still displays the value.

After hours of research, I still can't figure out what may cause that divergence. Both of my RadComboBox are declared the same way in xaml file  : 

<telerik:RadComboBox
      x:Name="listContact"
      ItemsSource="{Binding ListContactSignatureSales, Mode=OneWay}"
      DisplayMemberPath ="FullName"
      SelectedItem="{Binding Montage.ContratSales.ContactSignatureVente, Mode=TwoWay}"
      IsSynchronizedWithCurrentItem="false"
      PreviewKeyDown="RadComboBox_PreviewKeyDown"
      SelectionChanged="RadComboBox_SelectionChanged"
      Grid.Row="1" Grid.Column="2" Margin="5,0"
/>
<telerik:RadComboBox
     x:Name="listAdresse"
     ItemsSource="{Binding ListeAdresseDispo, Mode=OneWay}"
     DisplayMemberPath="DescriptionAdresse"
     SelectionChanged="listAdresse_SelectionChanged"
     PreviewKeyDown="listAdresse_PreviewKeyDown"
     SelectedItem="{Binding SelectedAdresse, Mode=TwoWay}"
     Grid.Row="3" Grid.Column="0"
/>

I added the PreviewKeyDown and SelectionChanged handlers myself for debug purposes and the IsSynchronizedWithCurrentItem property is set with a style in my xaml file for the second combobox :

<Style TargetType="telerik:RadComboBox">
     <Setter Property="FontFamily" Value="Calibri"/>
     <Setter Property="FontSize" Value="13"/>
     <Setter Property="FontWeight" Value="Normal"/>
     <Setter Property="Foreground" Value="Black"/>
     <Setter Property="BorderThickness" Value="1"/>
     <Setter Property="BorderBrush" Value="#FFDEDEDE"/>
     <Setter Property="Background" Value="White"/>
     <Setter Property="IsSynchronizedWithCurrentItem" Value="false"/>
     <Setter Property="Margin" Value="0,0,0,5"/>
</Style>

However the application is quite big so there might be other styles or general resources that I don't know of and that could be applied to one combobox and not the other (but I did not find any after digging a lot). I am sure that there is nothing in the code-behind concerning both these comboboxes (which means that there is no trick with events like PreviewKeyDown or SelectionChanged that would set the SelectedItem manually).

Have you any idea that could help me out ? Do you know any mechanism in your framework that could explain the difference between both my cases ?

Note : I have not been able to reproduce the second behavior in an external sample project so I understand that the "normal" behavior should be the first. However my client asks for the second behavior to be implemented and he says that it's already done in one screen which is true, I just can't figure out how...
Do not hesitate to ask for clarifications if I did not explain my problem clearly.

Thanks for your help,

Quentin.

No answers yet. Maybe you can help?

Tags
ComboBox
Asked by
Quentin
Top achievements
Rank 1
Share this question
or