I have in my XAML a listview:
<ListView HorizontalAlignment="Stretch" x:Name="jobs" VerticalAlignment="Stretch" DockPanel.Dock="Top" Foreground="Black" SelectionMode="Single" SelectionChanged="selectionJobChanger" IsSynchronizedWithCurrentItem="False">
<ListView.ItemContainerStyle>
<Style TargetType="{x:Type ListViewItem}">
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Foreground" Value="Black"/>
<Setter Property="Background" Value="Yellow"/>
</Trigger>
</Style.Triggers>
</Style>
</ListView.ItemContainerStyle>
<ListView.View>
<GridView>
<GridView.ColumnHeaderContainerStyle>
<Style BasedOn="{StaticResource {x:Type GridViewColumnHeader}}" TargetType="{x:Type GridViewColumnHeader}">
<Setter Property="IsHitTestVisible" Value="False"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
</Style>
</GridView.ColumnHeaderContainerStyle>
<GridViewColumn Header="Commessa" Width="Auto" DisplayMemberBinding="{Binding PrjCode}"/>
<GridViewColumn Header="Creazione" Width="Auto" DisplayMemberBinding="{Binding ValidFrom}"/>
<GridViewColumn Header="Descrizione" Width="Auto" DisplayMemberBinding="{Binding PrjName}"/>
<GridViewColumn Header="Tipo" Width="Auto" DisplayMemberBinding="{Binding Prototype}"/>
<GridViewColumn Header="Project Engineer" Width="Auto" DisplayMemberBinding="{Binding ProjectEngineer}"/>
<GridViewColumn Header="Product Manager" Width="Auto" DisplayMemberBinding="{Binding ProductManager}"/>
</GridView>
</ListView.View>
</ListView>
that is binded to this model:
public partial class Job
{
public string PrjCode;
public string PrjName;
public char Prototype;
public DateTime ValidFrom;
public DateTime ValidTo;
public string ProductManager;
public string ProjectEngineer;
}
In the codeBehind of the view I populate the listview:
public void showJobsList(List<Job> listOfJobs)
{
jobs.Items.Refresh();
jobs.ItemsSource = listOfJobs;
jobs.Items.Refresh();
}
This method is called inside the constructor of the presenter after populating the model with data coming from a query.
The problem is that in the listView I dont's see any item, but I'm sure that they are present because I can see, at mouse hover, several empty lines inside the listView and after I can get correctly these value for other scopes, but I desire that the listView works fine as is normal to be.