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

Binding problems custom class

1 Answer 92 Views
Carousel
This is a migrated thread and some comments may be shown as answers.
Jerry
Top achievements
Rank 1
Jerry asked on 05 Jan 2010, 11:50 AM
Hi all,

I'm trying to use a List of custom class to fill the itemsSource of RadCarousel.

This is the code of Page1.xaml:

<Page x:Class="Page1" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" 
    xmlns:carousel="clr-namespace:Telerik.Windows.Controls.Carousel;assembly=Telerik.Windows.Controls.Navigation" 
    Title="Page1"
    <Grid> 
        <telerik:RadCarousel x:Name="carPacientes" HorizontalAlignment="Stretch" 
                VerticalAlignment="Stretch" Background="Black" AutoGenerateDataPresenters="False" Foreground="White"
            <telerik:RadCarousel.Resources> 
                <Style TargetType="telerik:CarouselItem"
                    <Setter Property="Template"
                        <Setter.Value> 
                            <ControlTemplate TargetType="telerik:CarouselItem"
                                <Label Content="{Binding Path=Apellidos}" FontSize="12" Foreground="Black" Background="Aqua" /> 
                            </ControlTemplate> 
                        </Setter.Value> 
                    </Setter> 
                </Style> 
            </telerik:RadCarousel.Resources> 
        </telerik:RadCarousel> 
    </Grid> 
</Page> 
 

And this is the code to fill the RadCarousel Page1.xaml.vb:

Imports MDOL.Business.Logic 
 
Partial Public Class Page1 
 
    Public Shared opcion As String 
 
    Public Sub New() 
        InitializeComponent() 
 
        Dim pacs As List(Of Paciente) = New List(Of Paciente) 
 
        Dim pac As Paciente = Nothing 
 
        For i = 1 To 10 
 
            pac = New Paciente 
            pac.IdPaciente = Convert.ToString(i) 
 
            pac.Nombre = "Gerard" 
            pac.Apellidos = "Subirana" 
 
            pacs.Add(pac) 
            pac = Nothing 
        Next 
 
        Me.carPacientes.ItemsSource = pacs 
 
    End Sub 
 
End Class 

When I run the application appears 10 radcarousel items but the labels with the property Apellidos still empty... what's wrong?

Thank's in advance.

Gerard

1 Answer, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 06 Jan 2010, 12:51 PM
Hi Gerard Subirana Roger,

Please check out the Carousel -> CustomItemTemplate example in our online examples.

You might also want to check out the Carousel Items Documentation Topic.

Let us know if this does not help.

All the best,
Ross
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.
Tags
Carousel
Asked by
Jerry
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Share this question
or