Binding to DomainDataSource (RIA)

4 posts, 0 answers
  1. Gilbert van Veen
    Gilbert van Veen avatar
    68 posts
    Member since:
    Oct 2009

    Posted 24 Nov 2009 Link to this post

    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.

  2. Tihomir Petkov
    Admin
    Tihomir Petkov avatar
    576 posts

    Posted 27 Nov 2009 Link to this post

    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.
  3. DevCraft banner
  4. mnishak mn
    mnishak mn avatar
    3 posts
    Member since:
    Feb 2010

    Posted 15 Mar 2010 Link to this post

    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
  5. Gilbert van Veen
    Gilbert van Veen avatar
    68 posts
    Member since:
    Oct 2009

    Posted 16 Mar 2010 Link to this post

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