Hi,
please have a look to this XAML:
<ComboBox Grid.Row="1" Grid.Column="3" Name="cmbNazionalitaProp" Width="230" Margin="0,5,20,2"
ItemsSource="{Binding}" IsSynchronizedWithCurrentItem="True" SelectedValuePath = "codice"
DisplayMemberPath="descrizione" SelectedValue="{Binding Path=nazionalitam,Mode=TwoWay,UpdateSourceTrigger=LostFocus}"/>
and to the property definition in my class:
Private _nazionalitam As Nullable(Of Int32)
Public Property nazionalitam() As Nullable(Of Int32)
Get
Return _nazionalitam
End Get
Set(ByVal value As Nullable(Of Int32))
_nazionalitam = value
NotifyPropertyChange("nazionalitam")
End Set
End Property
I don't know why the _nazionalitam return value is equal to zero even if the value in the database field is NULL.
Anybody can help me?
Thank you very much
Gae
Public Function getAllNazionalita() As ObservableCollection(Of Nazionalita)
Dim lNazionalita As New ObservableCollection(Of Nazionalita)
Dim Nazionalita As Nazionalita
Try
tempDataReader = SelectData("SELECT * FROM TGESI_NAZIONALITA WHERE COD_ENTE = '" & codEnte & "' ORDER BY CODICE")
If tempDataReader.HasRows Then
Do While tempDataReader.Read
Nazionalita = New Nazionalita(codEnte,
formattaValore(tempDataReader("CODICE")),
formattaValore(tempDataReader("DESCRIZIONE")),
formattaValore(tempDataReader("SIGLA")))
lNazionalita.Add(Nazionalita)
Loop
tempDataReader.Close()
End If
Catch ex As Exception
MsgBox("Errore nella lettura della lista delle Tratte" & vbCrLf & ex.Message)
tempDataReader.Close()
lNazionalita = Nothing
End Try
Return lNazionalita
End Function
and in the Load event
Dim NazPropMot As ObservableCollection(Of Nazionalita)
NazPropMot = New ObservableCollection(Of Nazionalita)
NazPropMot = VeiManager.getAllNazionalita
cmbNazionalitaProp.ItemsSource = NazPropMot
Thank you
Gae