Eugen

Eugen

  • NA
  • 16
  • 0

WPF.Problem with Combobox.SelectedValue

May 24 2010 4:30 AM
I have a problem with  Combobox.SelectedValue
when I use  this property I don't have the result what this property must return

for eg.:
I have in WPF:

 <ComboBox Grid.Row="5" Grid.Column="2" Height="20" Visibility="Visible" Margin="3" Name="cb_client_cab" ItemsSource="{Binding}" >
                                    <ComboBox.ItemTemplate>
                                        <DataTemplate>
                                            <StackPanel Orientation="Horizontal">
                                                <TextBlock Text="{Binding nr_cabinet}" Width="50" />
                                            </StackPanel>
                                        </DataTemplate>
                                    </ComboBox.ItemTemplate>
                                </ComboBox>

I have in C#:
cb_client_cab.SelectedValue.ToString()
The result:
"System.Data.DataRowView"

but not : a value from database , combobox was populated with success, I can choose anything !!!

Help me please!



Answers (2)