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

Using Expression 4 Sample Data Sources

4 Answers 114 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jason Halbig
Top achievements
Rank 2
Jason Halbig asked on 20 Oct 2010, 05:35 PM
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!

4 Answers, 1 is accepted

Sort by
0
Jason Halbig
Top achievements
Rank 2
answered on 20 Oct 2010, 08:00 PM
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.
0
Accepted
Yavor
Telerik team
answered on 25 Oct 2010, 12:57 PM
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
0
Rick
Top achievements
Rank 1
answered on 18 Apr 2011, 09:32 PM
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?
0
Vanya Pavlova
Telerik team
answered on 20 Apr 2011, 08:43 AM
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
Tags
General Discussions
Asked by
Jason Halbig
Top achievements
Rank 2
Answers by
Jason Halbig
Top achievements
Rank 2
Yavor
Telerik team
Rick
Top achievements
Rank 1
Vanya Pavlova
Telerik team
Share this question
or