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

Retrieving SelectedValue from RadCombobox

1 Answer 118 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Mike Bendig
Top achievements
Rank 1
Mike Bendig asked on 16 Oct 2009, 11:52 AM
Hello!

I'm using the RadCombobox for WPF in a winform.  I am able to dynamically create the control populating it from a datasource and setting some other properties then adding the control as a .Child to an ElementHost control.  My problem is that I don't seem to be able to reference the selected value of the combobox through the ElementHost control.  I am also adding an "AddHandler" to this code but don't seem to have the right event to capture the change of selection.  The event at this point that seems to work is the DropDownClosed.  I'm using vb for code behind.  Any code examples or suggestions would be greatly appreciated!

Thanks much!
MB

1 Answer, 1 is accepted

Sort by
0
Mike Bendig
Top achievements
Rank 1
answered on 16 Oct 2009, 03:25 PM

Sorry no need to reply I figured it out.  For those new to this stuff here is my code:

 

Imports

 

Telerik.Windows.Controls

 

 

.
.
.

 

 

Dim myRadCBProjects As RadComboBox = New RadComboBox

 

 

...
...

 

myRadCBProjects.DataContext =

New BindingContext()

 

myRadCBProjects.ItemsSource = dt2.DefaultView

myRadCBProjects.DisplayMemberPath =

"Project"

 

 

 

 

myRadCBProjects.FilteringMode = FilteringMode.Contains

myRadCBProjects.IsEditable =

True

 

 

 

 

 

AddHandler myRadCBProjects.GotFocus, AddressOf myRadCBProjects_GotFocus

 

 

AddHandler myRadCBProjects.DropDownClosed, AddressOf myRadCBProjects_SelectedValue

 

myRadCBProjects.Text = TextBoxMaterialFamily.Text

 

Me.ElementHost1.BackColor = Color.White

 

 

Me.ElementHost1.Child = myRadCBProjects

 

.

.
.
.

 

 

Private Sub myRadCBProjects_SelectedValue()

 

 

Dim sText As String = myRadCBProjects.Text

 

 

If sText <> TextBoxMaterialFamily.Text Then

 

 

 

 

TextBoxMaterialFamily.Text = sText

 

End If

 

 

 

 

 

End Sub

 

 

 

Tags
ComboBox
Asked by
Mike Bendig
Top achievements
Rank 1
Answers by
Mike Bendig
Top achievements
Rank 1
Share this question
or