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

How to use the SeriesDefinition SeriesStyle

2 Answers 101 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Cedric
Top achievements
Rank 1
Cedric asked on 01 Aug 2011, 11:27 AM
Hi,

I'm trying to use the SeriesStyle property of the StackedSeriesDefinition to set  several properties for a lot graph but i get an XamlParseError :
Set property 'System.Windows.Style.TargetType' threw an exception
"'HorizontalStackedBarSeriesDefinition' type must derive from FrameworkElement or FrameworkContentElement."

Here is the xaml
<telerik:RadChart x:Name="chart7" ItemsSource="{Binding SampleData2}">
    <telerik:RadChart.SeriesMappings>
        <telerik:SeriesMapping LegendLabel="SUCCESS" CollectionIndex="0">
            <telerik:SeriesMapping.SeriesDefinition>
                <telerik:StackedBarSeriesDefinition SeriesItemLabelStyle="{StaticResource CustomSerieItemchart7}" SeriesStyle="{StaticResource MinimizedStackedBarSeriesDefinitionStyle}" />
            </telerik:SeriesMapping.SeriesDefinition>
....
<Style x:Uid="Style_26"
        x:Key="MinimizedStackedBarSeriesDefinitionStyle"
        TargetType="{x:Type telerik:HorizontalStackedBarSeriesDefinition}">
    <Setter x:Uid="Setter_216"
            Property="ShowItemLabels"
            Value="false" />
    <Setter x:Uid="Setter_217"
            Property="LabelSettings">
        <Setter.Value>
            <telerik:BarLabelSettings x:Uid="telerik:BarLabelSettings_1"
                                        LabelDisplayMode="Outside"
                                        ShowConnectors="False" />
        </Setter.Value>
    </Setter>
</Style>


Am i using the wrong property ?
Thanks
- Cedric -

2 Answers, 1 is accepted

Sort by
0
Cedric
Top achievements
Rank 1
answered on 01 Aug 2011, 02:54 PM
I have the same error with this style
<Style x:Key="MinimizedAxisStyle"
          x:Uid="Style_27"
          TargetType="{x:Type telerik:Axis}">
       <Setter x:Uid="Setter_218"
               Property="Title"
               Value="" />
       <Setter x:Uid="Setter_219"
               Property="AxisLabelsVisibility"
               Value="Collapsed" />
       <Setter x:Uid="Setter_220"
               Property="MajorTicksVisibility"
               Value="Collapsed" />
       <Setter x:Uid="Setter_221"
               Property="MinorTicksVisibility"
               Value="Collapsed" />
   </Style>
0
Sia
Telerik team
answered on 03 Aug 2011, 02:13 PM
Hello Cedric,

You need to use ItemStyle in your case. Customizing a series should be done by setting the SeriesDefinition.ItemStyle property for item-drawn series or the SeriesDefinition.SeriesStyle property for self-drawn series. More information about this topic is available here.

Regards,
Sia
the Telerik team

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

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