I have a ListView
that is data bound and I want to alter the font properties for each item. I'm not having much luck finding the appropriate properties. The ListView
is pretty simple so I don't expect it to be too difficult to change, I'm just not finding what I'm wanting as of yet.
<ListView ItemsSource="{Binding Updates}">
<ListView.View>
<GridView>
<GridViewColumn DisplayMemberBinding="{Binding TimeStamp}" Header="TimeStamp" />
<GridViewColumn DisplayMemberBinding="{Binding UpdateData}" />
</GridView>
</ListView.View>
</ListView>
You can set the 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 apply to the items of the ListView
, not the ListView
itself (e.g. the column headers won't be affected). If you want to apply those properties to the whole ListView
, you can set them directly on the ListView:
<ListView ItemsSource="{Binding Updates}"
Foreground="Blue" FontSize="14" ...>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With