有没有办法让TextAnnotation尊重它的X2值?我想在某个日期时间启动一个TextAnnotation并跨越到另一个。我会使用box注解,但我需要它包含文本并动态生成。
发布于 2019-12-26 11:35:51
在SciChart WPF中,TextAnnotation仅响应X1和X2的值。
您可以使用HorizontalAnchorPoint / VerticalAnchorPoint属性设置TextAnnotation的对齐方式。
您可以设置TextAnnotation的宽度/高度。
如果您想在框区域(X1、X2、Y1、Y2)中显示文本,那么可以考虑templating the BoxAnnotation。
<s:SciChartSurface.Annotations>
<s:BoxAnnotation X1="2" X2="8" Y1="2" Y2="8" Background="#33FFFFFF"
BorderBrush="#55FFFFFF" BorderThickness="3" Padding="5">
<s:BoxAnnotation.Template>
<ControlTemplate TargetType="s:BoxAnnotation">
<Border x:Name="PART_BoxAnnotationRoot"
Margin="{TemplateBinding Margin}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<Viewbox Margin="{TemplateBinding Padding}">
<TextBlock Text="Hello CustomAnnotation World!"></TextBlock>
</Viewbox>
</Border>
</ControlTemplate>
</s:BoxAnnotation.Template>
</s:BoxAnnotation>
</s:SciChartSurface.Annotations>
https://stackoverflow.com/questions/56153642
复制相似问题