
<Grid> |
<telerik:RadComboBox Height="23" HorizontalAlignment="Left" Margin="99,136,0,0" Name="ComboBox1" VerticalAlignment="Top" Width="120" IsEditable="True" IsReadOnly="False" /> |
<Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="52,230,0,0" Name="Button1" VerticalAlignment="Top" Width="75" /> |
</Grid> |
and added some items in code behind:
Private Sub ComboBox1_Loaded(... |
ComboBox1.Items.Add("aaa") |
ComboBox1.Items.Add("bbb") |
ComboBox1.Items.Add("ccc") |
End Sub |
When the user enters a new value in the edit box this value disappears when leaving the RadComboBox to click a button.
The standard WPF ComboBox does not loose the new value.
Hot can I allow the user to enter a value that is not in the drop down list?
11 Answers, 1 is accepted
I suppose that you are using older version of RadComboBox, which contains an already fixed bug. Please, try the latest internal build, it should resolve the problem:
http://www.telerik.com/account/downloads/internal-builds.aspx
All the best,
Valeri Hristov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.


Thank You.
Unfortunately, the RadComboBox is not designed to accomplish such scenario. When a user types in the RadComboBox ( in edit mode) the combo only searches for matches in the items collection.
If you want to send the input text to your view model, I would suggest you to find the TextBox control, placed in the RadComboBox( in edit mode ). You could bind the Text property of the TextBox to yourSubJob property in the ViewModel. For example:
private
void
Window_Loaded(
object
sender, RoutedEventArgs e)
{
IList<TextBox> textBoxes =
this
.cboSubJob.ChildrenOfType<TextBox>();
Binding binding =
new
Binding(
"SubJob"
);
binding.Mode = BindingMode.TwoWay;
textBoxes[0].SetBinding(TextBox.TextProperty, binding);
}
I hope this suits your needs. Please do not hesitate to contact us if you require any further information.
Regards,
George
the Telerik team

<
telerik:GridViewColumn
Header
=
"{x:Static res:Resources.ProductCode}"
>
<
telerik:GridViewColumn.CellTemplate
>
<
DataTemplate
>
<
TextBlock
Text
=
"{Binding ProductCode}"
></
TextBlock
>
</
DataTemplate
>
</
telerik:GridViewColumn.CellTemplate
>
<
telerik:GridViewColumn.CellEditTemplate
>
<
DataTemplate
>
<
telerik:RadComboBox
telerik:TextSearch.TextPath
=
"Code"
IsEditable
=
"True"
ItemTemplate
=
"{StaticResource ComboBoxCustomTemplate}"
Text
=
"{Binding ProductCode,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}"
SelectedItem
=
"{Binding Product, UpdateSourceTrigger=PropertyChanged}"
ItemsSource
=
"{Binding DataContext.ProductCodes, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:RadGridView}}}"
>
</
telerik:RadComboBox
>
</
DataTemplate
>
</
telerik:GridViewColumn.CellEditTemplate
>
</
telerik:GridViewColumn
>
private string _productCode;
public string ProductCode
{
get { return _productCode; }
set
{
if (value != null)
{
_productCode = value;
RaisePropertyChanged(() => ProductCode);
}
}
}

I am facing the same problem. Can you please help me how to find this textbox inside radcombobox in mvvm pattern??

Hi George,
Can you pls help how can I find this textbox using mvvm pattern in wpf. I am also facing same issue.
Thanks
Could you please share some more details on the exact scenario you need to achieve? RadComboBox exposes Text property which keeps the typed text, so you no longer need to get the TextBox inside. You can simply bind the Text property of the ComboBox to a property in the ViewModel.
Hope this helps.
Regards,
Kalin
Telerik

What I can suggest you would be to check the ComboBox Validation example from our online demos on the following link:
http://demos.telerik.com/silverlight/#ComboBox/Validation
The example is for Silverlight but you can use the same approach for WPF as well. Check the ViewModel class and the ValidateModel() and ValidateManufacturer() methods which actually do the validation. You can try to implement the same approach and modify the validation methods as needed.
Hope this will help you.
Regards,
Kalin
Telerik

Hi Telerik,
I'm using this code to implement an editable RadComboBox where it's authorized to write a value which isn't in ItemSource :
Private
Sub
UserControl_Loaded(sender
As
Object
, e
As
RoutedEventArgs)
'Allow not item source content to ReferenceMIR property
Dim
textBoxesRefMir
As
List(Of TextBox) =
Me
.cbxRefMIR.ChildrenOfType(Of TextBox)().ToList()
Dim
bindingRefMIR
As
Binding =
New
Binding(
"ReferenceMIR"
)
bindingRefMIR.Mode = BindingMode.TwoWay
textBoxesRefMir(0).SetBinding(TextBox.TextProperty, bindingRefMIR)
End
Sub
My RadComboBox :
<
telerik:RadComboBox
Grid.Row
=
"0"
Grid.Column
=
"1"
VerticalAlignment
=
"Center"
Style
=
"{StaticResource StyleEditableComboBox}"
ItemsSource
=
"{Binding Source={x:Static viewmodels:Main.Context}, Path=MIRs}"
x:Name
=
"cbxRefMIR"
SelectedValuePath
=
"Name"
DisplayMemberPath
=
"Name"
SelectedValue
=
"{Binding ReferenceMIR, Mode=TwoWay}"
/>
But I have a problem : not all characters are accepted. And when characters are accepted, when I leave the RadComboBox, the text is deleted.
Have you got any idea about this behavior ?
Thank you.