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

[Solved] How To Get SketchFlow Sample Data Into Grid?

3 Answers 161 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.
Mike Sue-Ping
Top achievements
Rank 1
Mike Sue-Ping asked on 25 Sep 2009, 08:23 PM
I've put the RadGridView control on a SketchFlow design surface and it magically appears to show data. While this is a nice feature to assist designing a grid, I'd like to have it use my own sample data.

Blend 3 allows me to define my own sample data and I can drag and drop it into a SilverLight 3 datagrid control. Can this be done with the Telerik RadGridView control too? If so, how? I've tried drag and drop and set the Data Binding to DataContext and Itemsource, but, neither work for me.

TIA
Mike

** Update ** Ok, since drag and drop didn't work (for me) I hacked the XAML that Blend 3 produces. I'm able to see my sample data now with the following code:

<Grid x:Name="LayoutRoot" Background="White" DataContext="{Binding Source={StaticResource SampleListingDataSource}}" >
<telerikGridView:RadGridView
Margin="8,130,8,42" 
FontFamily="Fonts/SketchFlow Print.ttf#SketchFlow Print" 
ItemsSource="{Binding Listings}" 
UseAlternateRowStyle="True">
</telerikGridView:RadGridView>
</Grid>

My issue now is, how do I control which columns appear in the RadGridView? They all show and I only want some. Can anyone tweak the XAML above to accomplish this? I think that I need to add some column controls but I can't figure it out.

3 Answers, 1 is accepted

Sort by
0
Kalin Milanov
Telerik team
answered on 30 Sep 2009, 02:53 PM
Hi Mike Sue-Ping,

You can do the following:
<telerikGridView:RadGridView  
    Margin="8,130,8,42"   
    FontFamily="Fonts/SketchFlow Print.ttf#SketchFlow Print"   
    ItemsSource="{Binding Listings}"   
    UseAlternateRowStyle="True" 
    AutoGenerateColumns="False">  
 
    <telerikGridView:RadGridView.Columns> 
        <telerikGridView:GridViewDataColumn DataMemberBinding="{Binding yourCollectionProperty}" /> 
    </telerikGridView:RadGridView.Columns> 
 
</telerikGridView:RadGridView> 
 

This will stop the auto generation of columns and then you will be adding the columns you need manually.

This should work perfectly in Blend's design surface though the grid will continue to auto generate columns runtime. We are aware of this bug and its fix should arrive with our Q3 release. Oddly enough this behavior is not present when working with a real DataSource.

Regards,
Kalin Milanov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Mike Sue-Ping
Top achievements
Rank 1
answered on 30 Sep 2009, 06:31 PM
Hi Kalin,
 
I'd stumbled across the solution prior to your reply. Thanks.
0
William Brown
Top achievements
Rank 1
answered on 09 Nov 2010, 11:30 PM
Hi MIke,

Can you share the solution?  I'm looking to do the same thing now.

TIA

Bill
Tags
General Discussions
Asked by
Mike Sue-Ping
Top achievements
Rank 1
Answers by
Kalin Milanov
Telerik team
Mike Sue-Ping
Top achievements
Rank 1
William Brown
Top achievements
Rank 1
Share this question
or