Dynamic Binding to Data Table

2 posts, 1 answers
  1. Matt Tapia
    Matt Tapia avatar
    18 posts
    Member since:
    Jul 2009

    Posted 21 Sep 2009 Link to this post

    I am dynamically binding the .ItemsSource and .DataContext property to a datatable in code like such:


    Dim myDataTable As New DataTable


    myDataTable = GetDataTable() 'returns datatable with multiple rows



    Me.myRadCarousel.ItemsSource = myDataTable

    However, the carousel shows blank images, even though they exist. I double-click on the carousel to get the file name and I get the file name no issue. my datatable contains 1 field (filename)











    <Style TargetType="{x:Type telerik:CarouselDataRecordPresenter}">







    <Setter Property="Template">














    <ControlTemplate TargetType="{x:Type telerik:CarouselDataRecordPresenter}">







    <Grid IsHitTestVisible="False" HorizontalAlignment="Stretch"













    <Image Source="{Binding Path=Fields[filename].Value}" Height="400" Width="400" />












































  2. Answer
    Milan avatar
    1989 posts

    Posted 23 Sep 2009 Link to this post

    Hi Matt Tapia,

    It seems that the binding to Fields[filename].Value is incorrect. Could you try to setup your binding like that:

    <Image Source="{Binding Path=Data[filename]}" Height="400" Width="400" />   
    <!--Where "filename" is a column name of your DataRow--> 


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