This is a migrated thread and some comments may be shown as answers.

How to change the color of selected chart item

1 Answer 76 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Datta
Top achievements
Rank 1
Datta asked on 29 Jul 2011, 07:53 AM
Hi

I want to change the color of selected chart bar item for RadChart.I have taken BarSeriesDefination.
How can I use use Visual Staes for RadChart  BarItem Selection ,MouseOver etc using Blend.


Thank's  & Regard's
Dattatray V. Medhane

1 Answer, 1 is accepted

Sort by
0
Sia
Telerik team
answered on 03 Aug 2011, 12:52 PM
Hi Datta,

When you drag a Bar in Blend and copy its template, you will see that there is a visual state manager with different states for Selected/Hovered. You can modify them according to your needs. Here is a xaml snippet:
<VisualStateManager.VisualStateGroups>
    <VisualStateGroup x:Name="HoverStates">
        <VisualState x:Name="Normal">
            <Storyboard>
                <DoubleAnimation Duration="0.00:00:00.15" To="1.0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_MainContainer"/>
            </Storyboard>
        </VisualState>
        <VisualState x:Name="Hovered">
            <Storyboard>
                <DoubleAnimation Duration="0.00:00:00.15" To="1.0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_MainContainer"/>
            </Storyboard>
        </VisualState>
        <VisualState x:Name="Hidden">
            <Storyboard>
                <DoubleAnimation Duration="0.00:00:00.15" To="0.15" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_MainContainer"/>
            </Storyboard>
        </VisualState>
    </VisualStateGroup>
    <VisualStateGroup x:Name="SelectionStates">
        <VisualState x:Name="Unselected"/>
        <VisualState x:Name="Selected">
            <Storyboard>
                <ObjectAnimationUsingKeyFrames Duration="0.00:00:00.05" Storyboard.TargetProperty="Stroke" Storyboard.TargetName="PART_SelectedState">
                    <DiscreteObjectKeyFrame KeyTime="0.00:00:00.0">
                        <DiscreteObjectKeyFrame.Value>
                            <SolidColorBrush Color="#B2000000"/>
                        </DiscreteObjectKeyFrame.Value>
                    </DiscreteObjectKeyFrame>
                </ObjectAnimationUsingKeyFrames>
                <ObjectAnimationUsingKeyFrames Duration="0.00:00:00.05" Storyboard.TargetProperty="StrokeThickness" Storyboard.TargetName="PART_SelectedState">
                    <DiscreteObjectKeyFrame KeyTime="0.00:00:00.0">
                        <DiscreteObjectKeyFrame.Value>
                            <System:Double>2</System:Double>
                        </DiscreteObjectKeyFrame.Value>
                    </DiscreteObjectKeyFrame>
                </ObjectAnimationUsingKeyFrames>
            </Storyboard>
        </VisualState>
    </VisualStateGroup>
</VisualStateManager.VisualStateGroups>

Greetings,
Sia
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Tags
Chart
Asked by
Datta
Top achievements
Rank 1
Answers by
Sia
Telerik team
Share this question
or