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

Binding to DomainDataSource (RIA)

3 Answers 115 Views
TileView
This is a migrated thread and some comments may be shown as answers.
Gilbert van Veen
Top achievements
Rank 1
Gilbert van Veen asked on 24 Nov 2009, 02:15 PM
Is it possible to bind the TileView directly to a RIA Domain Datasource?

 <DataTemplate x:Key="HeaderTemplate">  
            <TextBlock Text="{Binding FirstName}" /> 
        </DataTemplate> 
 
        <DataTemplate x:Key="ContentTemplate">  
            <telerik:RadFluidContentControl ContentChangeMode="Manual" State="Normal">  
                <!-- Small Content --> 
                <telerik:RadFluidContentControl.SmallContent> 
                    <Grid> 
                        <Grid.RowDefinitions> 
                            <RowDefinition Height="Auto" /> 
                            <RowDefinition Height="Auto" /> 
                        </Grid.RowDefinitions> 
                        <Grid.ColumnDefinitions> 
                            <ColumnDefinition Width="Auto" /> 
                            <ColumnDefinition Width="*" /> 
                        </Grid.ColumnDefinitions> 
 
                        <TextBlock Text="Product name: " FontWeight="Bold" /> 
                        <TextBlock Text="{Binding LastName}" Grid.Column="1" HorizontalAlignment="Left" /> 
 
                        <TextBlock Text="Product image: " FontWeight="Bold" Grid.Row="1" /> 
                        <Image Source="{Binding PictureUrl}" 
                               Grid.Row="1" 
                               Grid.Column="1" 
                               Width="50" 
                               Height="50" 
                               HorizontalAlignment="Left" /> 
                    </Grid> 
                </telerik:RadFluidContentControl.SmallContent> 
 
                <!-- Normal Content --> 
                <telerik:RadFluidContentControl.Content> 
                    <Grid> 
                        <Grid.RowDefinitions> 
                            <RowDefinition Height="Auto" /> 
                            <RowDefinition Height="Auto" /> 
                            <RowDefinition Height="Auto" /> 
                        </Grid.RowDefinitions> 
                        <Grid.ColumnDefinitions> 
                            <ColumnDefinition Width="Auto" /> 
                            <ColumnDefinition Width="*" /> 
                        </Grid.ColumnDefinitions> 
 
                        <TextBlock Text="Product name: " FontWeight="Bold" /> 
                        <TextBlock Text="{Binding FirstName}" Grid.Column="1" HorizontalAlignment="Left" /> 
 
                        <TextBlock Text="Product image: " FontWeight="Bold" Grid.Row="1" /> 
                        <Image Source="{Binding PictureUrl}" 
                               Grid.Row="1" 
                               Grid.Column="1" 
                               Width="50" 
                               Height="50" 
                               HorizontalAlignment="Left" /> 
 
                        <TextBlock Text="Product price: " FontWeight="Bold" Grid.Row="2" /> 
                        <TextBlock Text="123" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left" /> 
                    </Grid> 
                </telerik:RadFluidContentControl.Content> 
 
                <!-- Large Content --> 
                <telerik:RadFluidContentControl.LargeContent> 
                    <Grid> 
                        <Grid.RowDefinitions> 
                            <RowDefinition Height="Auto" /> 
                            <RowDefinition Height="Auto" /> 
                            <RowDefinition Height="Auto" /> 
                            <RowDefinition Height="Auto" /> 
                        </Grid.RowDefinitions> 
                        <Grid.ColumnDefinitions> 
                            <ColumnDefinition Width="Auto" /> 
                            <ColumnDefinition Width="*" /> 
                        </Grid.ColumnDefinitions> 
 
                        <TextBlock Text="Product name: " FontWeight="Bold" /> 
                        <TextBlock Text="{Binding FirstName}" Grid.Column="1" HorizontalAlignment="Left" /> 
 
                        <TextBlock Text="Product image: " FontWeight="Bold" Grid.Row="1" /> 
                        <Image Source="{Binding PictureUrl}" 
                               Grid.Row="1" 
                               Grid.Column="1" 
                               Width="50" 
                               Height="50" 
                               HorizontalAlignment="Left" /> 
 
                        <TextBlock Text="Product price: " FontWeight="Bold" Grid.Row="2" /> 
                        <TextBlock Text="123" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left" /> 
 
                        <TextBlock Text="Description: " FontWeight="Bold" Grid.Row="3" /> 
                        <TextBlock Text="{Binding LastName}" Grid.Row="3" Grid.Column="1" HorizontalAlignment="Left" /> 
                    </Grid> 
                </telerik:RadFluidContentControl.LargeContent> 
            </telerik:RadFluidContentControl> 
        </DataTemplate> 
 
    </UserControl.Resources> 
      
      
        <Grid x:Name="LayoutRoot" Background="White">                  
        <!--Columns--> 
        <Grid.ColumnDefinitions> 
            <ColumnDefinition></ColumnDefinition>  
        </Grid.ColumnDefinitions> 
        <!--Rows--> 
        <Grid.RowDefinitions> 
            <RowDefinition Height="*"></RowDefinition> 
            <RowDefinition></RowDefinition>  
        </Grid.RowDefinitions> 
 
        <!--RIA Connection--> 
        <riaControls:DomainDataSource   
            x:Name="personDataSource" 
            QueryName="GetPerson" 
            AutoLoad="True" 
            LoadSize="25"        
            > 
            <riaControls:DomainDataSource.DomainContext> 
                <ds:OrganizationContext x:Name="Test3"/>  
            </riaControls:DomainDataSource.DomainContext> 
            <!--<riaControls:DomainDataSource.QueryParameters> 
                <riaData:Parameter ParameterName="fEntityType" Value="0"/>  
            </riaControls:DomainDataSource.QueryParameters>--> 
        </riaControls:DomainDataSource> 
 
 
        <telerikNavigation:RadTileView  
            x:Name="MyTileView" 
            Grid.Row="0"   
            Grid.Column="0"   
            UseLayoutRounding="True" 
            ItemTemplate="{StaticResource HeaderTemplate}" 
            ContentTemplate="{StaticResource ContentTemplate}">  
            <!--<telerikNavigation:RadTileViewItem  
                Content="{Binding FirstName}" Header="{Binding LastName}">                  
            </telerikNavigation:RadTileViewItem>-->                     
        </telerikNavigation:RadTileView> 
          

When I run my program I just get empty tiles but I am sure that there is data in the personDataSource.

3 Answers, 1 is accepted

Sort by
0
Tihomir Petkov
Telerik team
answered on 27 Nov 2009, 12:30 PM
Hello Gilbert,

There should be no problem with binding to a DomainDataSource. Can you please check two things:

- you correctly set the ItemsSource of the TileView (I don't see it in the code you sent)
- is the number of empty Tiles you see the same as the number of objects in the data source?

If you can send me the sample project I will be able to debug it and let you know if the problem is in incorrect binding or you've discovered a bug.

P.S. If you are willing to send us the project, please note that you cannot attach it to a forum post and it will be better if you open a support ticket where you can attach files and our communication will be private.

Best wishes,
Tihomir Petkov
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
mnishak mn
Top achievements
Rank 1
answered on 15 Mar 2010, 01:00 PM
Hi,

How do you solved the problem? Are the following items you have are related to the issue?
- you correctly set the ItemsSource of the TileView (I don't see it in the code you sent)
- is the number of empty Tiles you see the same as the number of objects in the data source?

Please advise. Thanks

regards
MNishak
0
Gilbert van Veen
Top achievements
Rank 1
answered on 16 Mar 2010, 09:50 AM
Hi,

To be fair I didn't take to much time to dig into this.

I solved it (quickly) by executing the query to get DataContext. I itterate to trough the result of the DataContext and I generate a objectlist with my own objects. These objects contain the data which I need to display into the tiles. This objectlist is bound by the ItemSource.

Best regards,
Tags
TileView
Asked by
Gilbert van Veen
Top achievements
Rank 1
Answers by
Tihomir Petkov
Telerik team
mnishak mn
Top achievements
Rank 1
Gilbert van Veen
Top achievements
Rank 1
Share this question
or