Using Expression 4 Sample Data Sources

5 posts, 1 answers
  1. Jason Halbig
    Jason Halbig avatar
    2 posts
    Member since:
    Sep 2009

    Posted 20 Oct 2010 Link to this post

    Hey all,
    Just started using the Silverlight RAD Controls in Expression Blend 4 Premium.
    For the application I am building I have developed a number of Sample Data sources that I have leveraged in SketchFlow 4.

    The Sample Data sources work with the MS Silverlight Grid, however I am trying to bind it to a chart which does not seem to work.

    Am I trying something that is not supported at this time.

    Many thanks in advance!
  2. Jason Halbig
    Jason Halbig avatar
    2 posts
    Member since:
    Sep 2009

    Posted 20 Oct 2010 Link to this post

    Apparently the Sample Data Sources generated by Expression are:
          System.Collections.ObjectModel.ObservableCollection

    Whereas the RadChart is looking for an ItemSource that implements:
          System.Data.DataTable or System.Collections.IEnumerable

    It is worth noting that the charting controls in the Silverlight SDK do work with the Expression Sample Data Sources.
  3. Answer
    Yavor
    Admin
    Yavor avatar
    401 posts

    Posted 25 Oct 2010 Link to this post

    Hello Jason Halbig,

    RadChart supports Expression Sample Data, but currently doesn't support drag & drop configuration. You can add a DataGrid and drop a SampleData on top of it for the Expression Blend to configure it. Then just copy the xaml for the ItemsSource and RadChart should load the sample data. Make sure that the sample data's properties are numeric. Here is an example of using sample data:

    <Grid x:Name="LayoutRoot" Background="White" DataContext="{Binding Source={StaticResource SampleDataSource1}}">
        <telerik:RadChart ItemsSource="{Binding Collection}"/>
    </Grid>

    All the best,
    Yavor Ivanov
    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
  4. Rick
    Rick avatar
    1 posts
    Member since:
    Apr 2011

    Posted 18 Apr 2011 Link to this post

    I have tried this same type of code on a RadGrid and am not having any luck.  Any ideas on what I should try to do with a grid to get the sample data populated?
  5. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 20 Apr 2011 Link to this post

    Hello Rick,

     
    The approach described in the previous post is valid for RadGridView as well. In addition to this if you have to examine the property value of the underlying business object generated by Microsoft Expression Blend you need to use the approach demonstrated below:

    MainPage.xaml

    <Grid x:Name="LayoutRoot" Background="White" DataContext="{Binding Source={StaticResource SampleDataSource}}">
        <telerik:RadGridView Margin="32,32,32,80" RowLoaded="RadGridView_RowLoaded" ItemsSource="{Binding Collection}"/>
    </Grid>


    MainPage.xaml.cs

    private void RadGridView_RowLoaded(object sender, Telerik.Windows.Controls.GridView.RowLoadedEventArgs e)
           {
               if (e.Row is GridViewRow && !(e.Row is GridViewNewRow))
               {
                   Expression.Blend.SampleData.SampleDataSource.Item item = e.DataElement as Expression.Blend.SampleData.SampleDataSource.Item;
                   if (item.Property2)
                   {
                       ((GridViewRow)e.Row).Background = new SolidColorBrush(Colors.Orange);
                   }
               
           }



    You may find attached runnable project of the proposed solution.
     


    Regards,
    Vanya Pavlova
    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
Back to Top