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

MVVM & TitleStyle

2 Answers 67 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Courouble Damien
Top achievements
Rank 1
Courouble Damien asked on 01 Aug 2011, 08:14 AM
Hi guys, 

I'm working on chart with mvvm and need to bind the AxisX TitleStyle with a Style created and stored on my ViewModel
Unfortunately I haven't find the way to do it with xaml or with View CodeBehind

Can anyone guide me ?

Thanks,

Damien

2 Answers, 1 is accepted

Sort by
0
Courouble Damien
Top achievements
Rank 1
answered on 03 Aug 2011, 10:34 AM
Anyone ? 
0
Giuseppe
Telerik team
answered on 03 Aug 2011, 01:13 PM
Hi Courouble,

Indeed we must admit that currently it is not possible to use binding expression to set the AxisStyles.TitleStyle property and you will need to set it as a static resource instead:
<UserControl x:Class="ChartSLApplication.MainPage"
    mc:Ignorable="d"
    d:DesignHeight="700" d:DesignWidth="400"
   xmlns:demo="clr-namespace:ChartSLApplication"
     xmlns:telerikQuickStart="clr-namespace:Telerik.Windows.Controls.QuickStart;assembly=Telerik.Windows.Controls">
 
    <UserControl.DataContext>
        <demo:ViewModel />
    </UserControl.DataContext>
  
    <UserControl.Resources>
        <Style x:Key="CustomStyle" TargetType="telerik:AxisTitle">
            <Setter Property="Foreground" Value="Red" />
        </Style>
    </UserControl.Resources>
 
    <Grid x:Name="LayoutRoot" Background="White">
        <telerik:RadChart x:Name="RadChart1">
            <telerik:RadChart.SeriesMappings>
                <telerik:SeriesMapping ItemsSource="{Binding Data}">
                    <telerik:ItemMapping FieldName="Data" DataPointMember="YValue" />
                    <telerik:ItemMapping FieldName="XData" DataPointMember="XCategory" />
                </telerik:SeriesMapping>
            </telerik:RadChart.SeriesMappings>
            <telerik:RadChart.DefaultView>
                <telerik:ChartDefaultView>
                    <telerik:ChartDefaultView.ChartArea>
                        <telerik:ChartArea>
                            <telerik:ChartArea.AxisX>
                                <telerik:AxisX Title="TEST">
                                    <telerik:AxisX.AxisStyles>
                                        <telerik:AxisStyles TitleStyle="{StaticResource CustomStyle}" />
                                    </telerik:AxisX.AxisStyles>
                                </telerik:AxisX>
                            </telerik:ChartArea.AxisX>
                        </telerik:ChartArea>
                    </telerik:ChartDefaultView.ChartArea>
                </telerik:ChartDefaultView>
            </telerik:RadChart.DefaultView>
        </telerik:RadChart>
    </Grid>
 
</UserControl>

We have forwarded your bug report to our developers and it will be addressed for the next weekly internal build on Monday. We have updated your Telerik points as well.


Best wishes,
Giuseppe
the Telerik team

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

Tags
Chart
Asked by
Courouble Damien
Top achievements
Rank 1
Answers by
Courouble Damien
Top achievements
Rank 1
Giuseppe
Telerik team
Share this question
or