Posted 9 years ago
by Valéry Sablonnière
-
Staubli
Version: 15.1.0622
Platform: .NET 4.5
Environment: Windows 7 (64-bit)
Hi
I have two related issues when I’m trying to update all FontSize properties of highlighting styles, and apply it to a syntax editor:
- the line number font size of the syntax editor seems to be higher than the other font size styles (for example, when I set all font size to 12)
- the line height seems to be higher when you set a font size to the plain text style.
Here’s the code that I’m using (I tried directly this on your great sample):
Code behind:
private void FontFamilyComboBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
var l_fontFamily = ((FontFamily)((FontFamilyComboBox)sender).SelectedValue).Source;
foreach (var l_highlightingStyle in HighlightingStyleRegistry.HighlightingStyles)
{
l_highlightingStyle.FontFamilyName = l_fontFamily;
}
}
private void Selector_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
var l_fontSize = Convert.ToDouble(((FontSizeComboBox)sender).SelectedValue);
foreach (var l_highlightingStyle in HighlightingStyleRegistry.HighlightingStyles)
{
l_highlightingStyle.FontSize = l_fontSize;
}
}
Xaml:
<Label Content="FontFamily" Grid.Row="0"/>
<ribbon:FontFamilyComboBox Grid.Row="0" IsEditable="False" x:Name="FontFamilyComboBox" SelectionChanged="FontFamilyComboBox_OnSelectionChanged"/>
<Label Content="FontSize" Grid.Row="1"/>
<ribbon:FontSizeComboBox Grid.Row="1" IsEditable="False" SelectionChanged="Selector_OnSelectionChanged" />