danparker276
Top achievements
Rank 2
danparker276
asked on 28 Jul 2011, 05:49 PM
I have IsReadOnly set to false and I have an event on selectionChanged.
When selection changed is called, it shows the old value in the textbox though. In the nonpulblic area of the combo box, editableTextbox.Text shows the correct value. Any easy way of getting it?
When selection changed is called, it shows the old value in the textbox though. In the nonpulblic area of the combo box, editableTextbox.Text shows the correct value. Any easy way of getting it?
3 Answers, 1 is accepted
0
Hi Dan,
I cannot reproduce this issue, could you please send us some sample code to demonstrate your exact approach? Thanks in advance
Greetings,
Yana
the Telerik team
I cannot reproduce this issue, could you please send us some sample code to demonstrate your exact approach? Thanks in advance
Greetings,
Yana
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
0
danparker276
Top achievements
Rank 2
answered on 02 Aug 2011, 06:21 PM
It's not that big a deal, I found a way around it, but when I'm using a radcombo box and it's auto completing, but I just want to get the text I've typed in.
Say, I type I'm looking for blue, I type in 'blu' and it selects blue. I want to know that only blu was typed in. I only found that information in the non-public editableTextBox. I can use reflection to get those attributes, but I was wondering if there was an easier way. The text value of the radcombobox doesn't get the current value.
private void myComboBox_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangedEventArgs e)
{
myComboBox.Text // This is not the value I just keyed in
<telerik:RadComboBox x:Name="myComboBox" OpenDropDownOnFocus="False"
Margin="5 0 5 0" IsReadOnly="False" LostFocus="rcMatterSubId_LostFocus"
SelectionChanged="myComboBox_SelectionChanged"
ClearSelectionButtonVisibility="Visible" ClearSelectionButtonContent="Clear"
Width="60"
IsEditable="True"
/>
Say, I type I'm looking for blue, I type in 'blu' and it selects blue. I want to know that only blu was typed in. I only found that information in the non-public editableTextBox. I can use reflection to get those attributes, but I was wondering if there was an easier way. The text value of the radcombobox doesn't get the current value.
private void myComboBox_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangedEventArgs e)
{
myComboBox.Text // This is not the value I just keyed in
<telerik:RadComboBox x:Name="myComboBox" OpenDropDownOnFocus="False"
Margin="5 0 5 0" IsReadOnly="False" LostFocus="rcMatterSubId_LostFocus"
SelectionChanged="myComboBox_SelectionChanged"
ClearSelectionButtonVisibility="Visible" ClearSelectionButtonContent="Clear"
Width="60"
IsEditable="True"
/>
0
Hi Dan,
SelectionChanged event is fired when the the item is changed, that's why you cannot get the typed text like this.
I would suggest to bind the Text of the ComboBox to a property in your ViewModel - in this way you can get the text as soon as it's updated:
the ViewModel:
Hope this approach suits your needs.
Best wishes,
Yana
the Telerik team
SelectionChanged event is fired when the the item is changed, that's why you cannot get the typed text like this.
I would suggest to bind the Text of the ComboBox to a property in your ViewModel - in this way you can get the text as soon as it's updated:
<
telerik:RadComboBox
x:Name
=
"myComboBox"
OpenDropDownOnFocus
=
"False"
Grid.Row
=
"1"
Margin
=
"5 0 5 0"
IsReadOnly
=
"False"
SelectionChanged
=
"myComboBox_SelectionChanged"
ClearSelectionButtonVisibility
=
"Visible"
ClearSelectionButtonContent
=
"Clear"
Width
=
"60"
Text
=
"{Binding ComboBoxText, Mode=TwoWay}"
IsEditable
=
"True"
/>
the ViewModel:
public
class
MyViewModel : ViewModelBase
{
private
string
_comboBoxText;
public
string
ComboBoxText
{
set
{
if
(value != _comboBoxText)
{
_comboBoxText = value;
this
.OnPropertyChanged(
"ComboBoxText"
);
}
}
get
{
return
_comboBoxText;
}
}
}
Hope this approach suits your needs.
Best wishes,
Yana
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>