I'm unable to "clear" the current selection from a RadCombobox when needed. This RadCombobox is rebound with new data depending on the value of another radcombobox. After the rebinding, the prior selection should be cleared out. But it still displays. If the prior selection was "OAK", then the combobox still shows OAK as a selection when it should be blank. I find radcomboboxes very tricky to set up so I'm sure it's something dumb on my part.
The Text property of the combobox is bound to woodSpecies which is set up below:
<telerik:RadComboBox x:Name="cboWoodSpecies"
FontSize="16" Background="#F6F8FA" BorderBrush="#D7D8DD"
ItemsSource="{Binding}"
SelectedValue="theWoodSpecies"
Text="{Binding woodSpecies}"
telerik:TextSearch.TextPath="theWoodSpecies"
IsEditable="True"
Style="{DynamicResource RadComboBoxStyle3}" >
<telerik:RadComboBox.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="{Binding theWoodSpecies}"/>
<TextBlock Grid.Column="1" Text="{Binding WoodSpeciesUpchargeDisplay}"/>
<TextBlock Grid.Column="2" Text="{Binding WoodSpeciesUpcharge}" Visibility="Hidden"/>
</Grid>
</DataTemplate>
</telerik:RadComboBox.ItemTemplate>
</telerik:RadComboBox>
Private _woodSpecies As String
Public Property woodSpecies As String
Get
Return _woodSpecies
End Get
Set(value As String)
_woodSpecies = value
NotifyPropertyChanged("woodSpecies")
End Set
End Property
When it's time to clear the prior selection, this code is run:
thisOrder = New Order 'sets woodSpecies to empty string. Verified by debug.
cboWoodSpecies.SelectedIndex = -1 ' A debug break here shows that thisOrder.woodSpecies is empty string
The only way I can blank out the radcombobox is by using this code below. But I thought that was the whole point of INotifyPropertyChanged.
cboWoodSpecies.Text = String.Empty
How to fix this? Thanks.
I forgot to add Mode=TwoWay to Text="{Binding woodSpecies}"