I can’t seem to directly set the font color of a VerticalLineAnnotation.
I found this link which shows how to set it directly, but that doesn’t seem to do anything either (is it broken again?)
Here is some of my code:
<Style x:Key="sliceStyle" TargetType="s:VerticalLineAnnotation">
<Setter Property="ShowLabel" Value="True"/>
<Setter Property="Stroke" Value="#ff4"/>
<Setter Property="IsEditable" Value="True"/>
<Setter Property="Foreground" Value="#225"/>
<Setter Property="LabelPlacement" Value="Axis"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Stroke" Value="Blue"/>
</Trigger>
</Style.Triggers>
</Style>
<s:SciChartSurface.ChartModifier>
<s:ModifierGroup>
<s:VerticalSliceModifier Name="sliceModifier">
<s:VerticalSliceModifier.VerticalLines>
<s:VerticalLineAnnotation Style="{StaticResource sliceStyle}" X1="1" />
<s:VerticalLineAnnotation X1="3" Stroke="#ff4" IsEditable="True" LabelPlacement="Axis" ShowLabel="True" >
<s:AnnotationLabel LabelPlacement="TopRight" Text="initially3" Foreground="Green"/>
</s:VerticalLineAnnotation>
</s:VerticalSliceModifier.VerticalLines>
</s:VerticalSliceModifier>
</s:ModifierGroup>
</s:SciChartSurface.ChartModifier>
Thanks for any insight!
- dwoerner asked 9 years ago
- last active 9 years ago
I have a SciChartLegend below my chart that was using the default item template in v6.4, and I could change the color of my legend labels simply by setting the Foreground property of the SciChartLegend. However, when I updated to SciChart 6.5.1, the font of my legend labels changed to all black. If I investigate my UI using Snoop, I see the following Binding error on the TextBlock.Foreground property for one of my legend items:
System.Windows.Data Error: 4 : Cannot find source for binding with reference ‘RelativeSource FindAncestor, AncestorType=’SciChart.Charting.Visuals.RenderableSeries.LegendPlaceholder’, AncestorLevel=’1”. BindingExpression:Path=Foreground; DataItem=null; target element is ‘TextBlock’ (Name=”); target property is ‘Foreground’ (type ‘Brush’)
I also tried v6.5.0, and this behavior did not occur – it is new in v6.5.1
Below is the definition of my legend.
<s:SciChartLegend x:Name="legend"
LegendData="{Binding ElementName=LegendModifier, Path=LegendData}"
Orientation="Horizontal"
BorderBrush="White"
FontSize="14"
BorderThickness="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
ShowVisibilityCheckboxes="True">
<s:SciChartLegend.ItemsPanel>
<ItemsPanelTemplate>
<chartUtils:UniformWrapPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</s:SciChartLegend.ItemsPanel>
</s:SciChartLegend>
- Brandon Dybala asked 2 years ago
- last active 3 months ago