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

How get Selected Item in ComboBox

1 Answer 74 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Nelson
Top achievements
Rank 1
Nelson asked on 17 Jun 2011, 03:36 PM
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

1 Answer, 1 is accepted

Sort by
0
Nelson
Top achievements
Rank 1
answered on 17 Jun 2011, 03:50 PM
I already fix the problem.
Tags
ComboBox
Asked by
Nelson
Top achievements
Rank 1
Answers by
Nelson
Top achievements
Rank 1
Share this question
or