How can I create ListView items?

I have a ListView associated with data, and I want to change the font properties for each item. I was not lucky to find suitable properties. ListView pretty simple, so I don’t expect it to be too difficult to change, I still can’t find what I want.

 <ListView ItemsSource="{Binding Updates}"> <ListView.View> <GridView> <GridViewColumn DisplayMemberBinding="{Binding TimeStamp}" Header="TimeStamp" /> <GridViewColumn DisplayMemberBinding="{Binding UpdateData}" /> </GridView> </ListView.View> </ListView> 
+7
source share
1 answer

You can set ItemContainerStyle :

 <ListView ItemsSource="{Binding Updates}"> <ListView.View> <GridView> <GridViewColumn DisplayMemberBinding="{Binding TimeStamp}" Header="TimeStamp" /> <GridViewColumn DisplayMemberBinding="{Binding UpdateData}" /> </GridView> </ListView.View> <ListView.ItemContainerStyle> <Style TargetType="ListViewItem"> <Setter Property="FontSize" Value="14" /> <Setter Property="Foreground" Value="Blue" /> <Setter Property="FontWeight" Value="Bold" /> <Setter Property="FontStyle" Value="Italic" /> </Style> </ListView.ItemContainerStyle> </ListView> 

Note that it will be applied to ListView elements, not to ListView itself (for example, column headings will not be affected). If you want to apply these properties to the entire ListView , you can set them directly in the ListView:

 <ListView ItemsSource="{Binding Updates}" Foreground="Blue" FontSize="14" ...> 
+21
source

All Articles