Click here to Skip to main content
14,484,284 members
Rate this:
Please Sign up or sign in to vote.
See more: , +

I have been searching around without finding a fix so here I go.

I have a Windows with a center that contain a UserControl that will fill the general area of my application.

I have a TabControl with multiple TabItem. In each TabItem I have to show different controls including Datagrids.

Here is the sample code of my second TabItem.
<TabItem Header="Suivi" IsSelected="True">
           <Grid Background="#FFE5E5E5" >
               <DataGrid x:Name="dgSuivi" ItemsSource="{Binding Source=Suivi}" AutoGenerateColumns="False" CanUserAddRows="False"  >
                       <DataGridTextColumn Header="Suivi" Binding="{Binding COD_NOM }" Width="500" />
                       <DataGridTextColumn Header="Date planifiée" Binding="{Binding DAT_PLAN}" Width="150" />
                       <DataGridTextColumn Header="Date révisée" Binding="{Binding DAT_REVIS}" Width="150" />
                       <DataGridTextColumn Header="Date réelle" Binding="{Binding DAT_REEL}" Width="150" />

My code behind has a filled property called Suivi.

Public Property Suivi As ObservableCollection(Of MyType)

and MyType is the following class:

Public Class EntiteSgcrSuivi

     Property COD_NOM as String

     Property DAT_PLAN as DateTime

     Property DAT_REVIS as DateTime

     Property DAT_REEL as DateTime

     Property DAT_RAPPEL as DateTime

     Public Sub New()

      COD_NOM_DAT = Nothing
      DAT_PLAN = New System.DateTime(9999, 1, 1)
      DAT_REVIS = New System.DateTime(9999, 1, 1)
      DAT_REEL = New System.DateTime(9999, 1, 1)

     End Sub

    End Class

When I change to the second TabItem (Suivi) the datagrid is filled with empty lines.

[Picture of the datagrid not being filled](

I've been searching to fix this but I think I am missing a notion here.
Is my binding done right?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100