How get Selected Item in ComboBox

2 posts, 0 answers
  1. Nelson
    Nelson avatar
    62 posts
    Member since:
    Apr 2011

    Posted 17 Jun 2011 Link to this post

    Hi,

    Someone can explain how I can get the Selected Item in ComboBox?

    I want bind the selected Item to one variable in my ViewModel.

    I did this code:

    <telerik:RadComboBox Grid.Column="1" Grid.Row="1" Width="100" Height="20" HorizontalAlignment="Left"
                                                               ItemsSource="{Binding Path=DataContext.OCTiposNotificacao, ElementName=LayoutRoot2}"
                                                               DisplayMemberPath="DesignacaoProp" telerik:StyleManager.Theme="Expression_Dark"
                                                               SelectedItem="{Binding Path=DataContext.TipoNotificacaoSeleccionado, Mode=TwoWay}" />

    In my ItemsSource I did this:
    ItemsSource
    ="{Binding Path=DataContext.OCTiposNotificacao, ElementName=LayoutRoot2}"

    because  the "OCTiposNotificacao" is a second collection, that means that I have two collections in my ViewModel, so I declare like Path=DataContext.OCTiposNotificacao.

    And I want bind the Selected Item to TipoNotificacaoSeleccionado.

    But all I get is a null value...

    Any help?

    Thanks
  2. Nelson
    Nelson avatar
    62 posts
    Member since:
    Apr 2011

    Posted 17 Jun 2011 Link to this post

    I already fix the problem.
  3. DevCraft banner
Back to Top