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

How can I reuse the simple style that customizes a chart series through ItemStyle?

1 Answer 103 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Can
Top achievements
Rank 1
Can asked on 03 Aug 2010, 05:46 PM
Hi,

I hate writing a title for a thread because sometimes it's impossible to explain my question in short :)

Anyway I've found the below style from this article in KB. What I want to do is being able to reuse this style in more than one chart or more than one series by just changing the color. But although I've tried to make "TemplateBinding" to Background property of Bar class or to some other control part but I wasn't able to do it. I couldn't find the place (if I can) to specify the Background property.

<Window.Resources>  
        <Style x:Key="MyStyle" TargetType="{x:Type telerik:Bar}">  
            <Setter Property="Template" >  
                <Setter.Value>  
                    <ControlTemplate TargetType="{x:Type telerik:Bar}">  
                        <Rectangle  
                                   x:Name="PART_DefiningGeometry"  
                                   Fill="Red"
                                   Stroke="Pink"   
                                   StrokeThickness="3"   
                                   Height="{TemplateBinding ActualHeight}"  
                                   Width="{TemplateBinding ActualWidth}"/>  
                    </ControlTemplate>  
                </Setter.Value>  
            </Setter>  
        </Style>  
    </Window.Resources>

As a summary what I want to do is to bind Fill property to some other property on a control and reuse this style. It should be easy! But not for me?

Does anyone have an idea?

Thanks

1 Answer, 1 is accepted

Sort by
0
Sia
Telerik team
answered on 06 Aug 2010, 11:45 AM
Hello Can,

Please check the MVVM example on our demo site and tell me if you need additional help.

Regards,
Sia
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Chart
Asked by
Can
Top achievements
Rank 1
Answers by
Sia
Telerik team
Share this question
or