Binding problems custom class

2 posts, 0 answers
  1. Jerry
    Jerry avatar
    3 posts
    Member since:
    Jan 2010

    Posted 05 Jan 2010 Link to this post

    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
  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 06 Jan 2010 Link to this post

    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.
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top