❔ WPF Converter Infinite call
Hi!
I am trying to make a converter that makes fontsize relative to the binding by ratio
the problem is that it is jumping around as seen in the picture
my xaml:
I am trying to make a converter that makes fontsize relative to the binding by ratio
the problem is that it is jumping around as seen in the picture
my xaml:
<UserControl.Resources>
<converters:RelativeFontSizeConverter
x:Key="RelativeFontSizeConverter"
WhenInvalid="15" />
<converters:MathConverter x:Key="MathConverter" />
</UserControl.Resources>
<Grid Margin="14,14">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<Grid.RowDefinitions>
<RowDefinition Height="3*" />
<RowDefinition Height="2*" />
</Grid.RowDefinitions>
<TextBlock
Grid.Row="0"
d:Text="Tell Mark"
FontSize="{Binding ActualHeight, ConverterParameter='0.7', Converter={StaticResource RelativeFontSizeConverter}, RelativeSource={RelativeSource Self}}"
FontWeight="SemiBold"
Foreground="{StaticResource BrushFgDefault}"
Text="{Binding Todo.Title}"
TextTrimming="CharacterEllipsis" />
<TextBlock
Grid.Row="1"
d:Text="Tell Mark the details of the project that he has been recently included in"
FontSize="{Binding ActualHeight, ConverterParameter='0.7', Converter={StaticResource RelativeFontSizeConverter}, RelativeSource={RelativeSource Self}}"
Foreground="{StaticResource BrushFgMuted}"
Text="{Binding Todo.Description}"
TextWrapping="Wrap" />
</Grid>
<!-- scalable square button up to 80x80 -->
<Viewbox
Grid.Column="1"
MaxWidth="80"
MaxHeight="80"
VerticalAlignment="Top"
Stretch="Uniform">
...
</Viewbox>
</Grid>
</Grid><UserControl.Resources>
<converters:RelativeFontSizeConverter
x:Key="RelativeFontSizeConverter"
WhenInvalid="15" />
<converters:MathConverter x:Key="MathConverter" />
</UserControl.Resources>
<Grid Margin="14,14">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<Grid.RowDefinitions>
<RowDefinition Height="3*" />
<RowDefinition Height="2*" />
</Grid.RowDefinitions>
<TextBlock
Grid.Row="0"
d:Text="Tell Mark"
FontSize="{Binding ActualHeight, ConverterParameter='0.7', Converter={StaticResource RelativeFontSizeConverter}, RelativeSource={RelativeSource Self}}"
FontWeight="SemiBold"
Foreground="{StaticResource BrushFgDefault}"
Text="{Binding Todo.Title}"
TextTrimming="CharacterEllipsis" />
<TextBlock
Grid.Row="1"
d:Text="Tell Mark the details of the project that he has been recently included in"
FontSize="{Binding ActualHeight, ConverterParameter='0.7', Converter={StaticResource RelativeFontSizeConverter}, RelativeSource={RelativeSource Self}}"
Foreground="{StaticResource BrushFgMuted}"
Text="{Binding Todo.Description}"
TextWrapping="Wrap" />
</Grid>
<!-- scalable square button up to 80x80 -->
<Viewbox
Grid.Column="1"
MaxWidth="80"
MaxHeight="80"
VerticalAlignment="Top"
Stretch="Uniform">
...
</Viewbox>
</Grid>
</Grid>