Retrieving SelectedValue from RadCombobox

2 posts, 0 answers
  1. Mike Bendig
    Mike Bendig avatar
    3 posts
    Member since:
    Jun 2012

    Posted 16 Oct 2009 Link to this post

    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
  2. Mike Bendig
    Mike Bendig avatar
    3 posts
    Member since:
    Jun 2012

    Posted 16 Oct 2009 Link to this post

    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

     

     

     

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top