SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.

1
0

How do I change the selection marker of an annotation? It seems to default to green squares of a certain size, which is all I can find in your examples. I tried to search the knowledgebase and forums but could not seem to find this answer. I would like to be able to control the color, shape, and size of the selection indicators for each annotation in my chart.

Thanks.

  • You must to post comments
0
0

Hi there,

The AnnotationBase.ResizingGripsStyle can be used to style the drag markers. The marker is TargetType Thumb if that helps. The default style is declared like this:

<Style TargetType="Thumb">
    <Setter Property="BorderThickness" Value="1" />
    <Setter Property="IsTabStop" Value="False" />
    <Setter Property="Cursor" Value="Hand" />
    <Setter Property="Background" Value="Green" />
    <Setter Property="Width" Value="{z:Static Member=visuals:ManipulationMargins.AnnotationResizingThumbSize}" />
    <Setter Property="Height" Value="{z:Static Member=visuals:ManipulationMargins.AnnotationResizingThumbSize}" />
    <Setter Property="Opacity" Value="0.4" />
    <Setter Property="BorderBrush">
        <Setter.Value>
            <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                <GradientStop Offset="0" Color="#FFA3AEB9" />
                <GradientStop Offset="0.375" Color="#FF8399A9" />
                <GradientStop Offset="0.375" Color="#FF718597" />
                <GradientStop Offset="1" Color="#FF617584" />
            </LinearGradientBrush>
        </Setter.Value>
    </Setter>
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="Thumb">
                <Grid>
                    <VisualStateManager.VisualStateGroups>
                        <VisualStateGroup x:Name="CommonStates">
                            <VisualState x:Name="Normal" />
                            <VisualState x:Name="MouseOver">
                                <Storyboard>
                                    <DoubleAnimation Duration="0"
                                                     Storyboard.TargetName="BackgroundAnimation"
                                                     Storyboard.TargetProperty="Opacity"
                                                     To="1" />
                                    <ColorAnimation Duration="0"
                                                    Storyboard.TargetName="Background"
                                                    Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
                                                    To="#FF6DBDD1" />
                                </Storyboard>
                            </VisualState>
                            <VisualState x:Name="Pressed">
                                <Storyboard>
                                    <DoubleAnimation Duration="0"
                                                     Storyboard.TargetName="BackgroundAnimation"
                                                     Storyboard.TargetProperty="Opacity"
                                                     To="1" />
                                    <ColorAnimation Duration="0"
                                                    Storyboard.TargetName="Background"
                                                    Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
                                                    To="#FF6DBDD1" />
                                </Storyboard>
                            </VisualState>
                            <VisualState x:Name="Disabled">
                                <Storyboard>
                                    <DoubleAnimation Duration="0"
                                                     Storyboard.TargetName="DisabledVisualElement"
                                                     Storyboard.TargetProperty="Opacity"
                                                     To=".55" />
                                </Storyboard>
                            </VisualState>
                        </VisualStateGroup>
                        <VisualStateGroup x:Name="FocusStates">
                            <VisualState x:Name="Focused">
                                <Storyboard>
                                    <DoubleAnimation Duration="0"
                                                     Storyboard.TargetName="FocusVisualElement"
                                                     Storyboard.TargetProperty="Opacity"
                                                     To="1" />
                                </Storyboard>
                            </VisualState>
                            <VisualState x:Name="Unfocused" />
                        </VisualStateGroup>
                    </VisualStateManager.VisualStateGroups>
                    <Border x:Name="Background"
                            Background="White"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            CornerRadius="2">
                        <Grid Margin="1" Background="{TemplateBinding Background}">
                            <Border x:Name="BackgroundAnimation"
                                    Background="#FF448DCA"
                                    Opacity="0" />
                            <Rectangle x:Name="BackgroundGradient" Fill="{TemplateBinding Background}" />
                        </Grid>
                    </Border>
                    <Rectangle x:Name="DisabledVisualElement"
                               Fill="#FFFFFFFF"
                               IsHitTestVisible="false"
                               Opacity="0"
                               RadiusX="2"
                               RadiusY="2" />
                    <Rectangle x:Name="FocusVisualElement"
                               Margin="1"
                               IsHitTestVisible="false"
                               Opacity="0"
                               RadiusX="1"
                               RadiusY="1"
                               Stroke="#FF6DBDD1"
                               StrokeThickness="1" />
                </Grid>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

By modifying the above you should be able to change the look & feel as well as handle mouse-over states either with Triggers or the VisualStateManager.

If you need further help, do let me know.

Best regards,
Andrew

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.