I set a FontSize property in my viewmodel, then I bind it in my Style, but the Fontsize doesn't trickle down to my listview label. I've also tried binding directly on the listview label, but this doesn't work either. If I hard code my fontsize into the style, it works but I need dynamic fontsize, especially in UWP.
Also, please notice that my data binds properly inside the listview but my TextColor won't bind either. Anything you can think of would be greatly appreciated.
//My Style
<Style x:Key="settingsLabelStyle2" TargetType="Label" BasedOn="{StaticResource settingsLabelStyle}">
<Setter Property="HorizontalOptions" Value="Start" />
<Setter Property="VerticalTextAlignment" Value="Center" />
<Setter Property="FontSize" Value="{Binding ScoreFontSize}" />
</Style>
//Part of my listview
<DataTemplate>
<ViewCell>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="7*" />
<ColumnDefinition Width="4*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Text="{Binding GameDate}" Style="{DynamicResource DynamicSettingsLabelStyle2}" />
<Label Grid.Column="1" Text="{Binding PlayerName}" Style="{DynamicResource DynamicSettingsLabelStyle2}" />
<Label Grid.Column="2" Text="{Binding Score}" Style="{DynamicResource DynamicSettingsLabelStyle2}" />
</Grid>
</ViewCell>
</DataTemplate>
//My Fontsize property
private double scoreFontSize = 20;
public double ScoreFontSize
{
get { return scoreFontSize; }
set
{
SetProperty(ref scoreFontSize, value);
OnPropertyChanged();
}
}