Telerik blogs

Hello RadChart fans everywhere! With the introduction of Silverlight 4 just a couple of months ago a lot of our customers are asking if they can use the cool RIA controls with RadChart without writing any C# or VB code at all. With MVVM pattern getting so popular with Silverlight developers it is all about the XAML these days. Without further ado let’s answer the question:

 

The short answer is: Yes! The long answer: Yes, and it’s a total breeze! Just take a look at some code:

Code Snippet
<Grid x:Name="LayoutRoot" Background="White">
    <riaControls:DomainDataSource AutoLoad="True" Name="productDomainDataSource" QueryName="GetProductsQuery">
        <riaControls:DomainDataSource.DomainContext>
            <my:DomainService1 />
        </riaControls:DomainDataSource.DomainContext>
    </riaControls:DomainDataSource>
    <telerik:RadChart ItemsSource="{Binding Data, ElementName=productDomainDataSource}">
        <telerik:RadChart.SeriesMappings>
            <telerik:SeriesMapping LegendLabel="Product Quantities">
                <telerik:SeriesMapping.ItemMappings>
                    <telerik:ItemMapping FieldName="ProductName" DataPointMember="XCategory" />
                    <telerik:ItemMapping FieldName="UnitsInStock" DataPointMember="YValue" />
                </telerik:SeriesMapping.ItemMappings>
            </telerik:SeriesMapping>
        </telerik:RadChart.SeriesMappings>
    </telerik:RadChart>
</Grid>

This is just setting up the basics, of course. You can go further and specify label formatting, appearance, and even data manipulation features such as filtering, sorting, grouping, aggregation all using pure XAML without ever writing a line of C# or VB or having to re-template something. It all just works out of the box!

To make your lives easier I have prepared a small sample and attached it to this blog post.


About the Author

Vladimir Milev

Vladimir Milev is a developer manager.

Comments

Comments are disabled in preview mode.