locked
Databinding question RRS feed

  • Question

  • I have a listbox as follows:

    <ListBox x:Name="ReviewList" Background="Transparent" ScrollViewer.HorizontalScrollBarVisibility="Hidden" Height="172" Width="270" Canvas.Top="21" Opacity="1" Margin="10,0,-10,-173" VerticalAlignment="Bottom" SelectionChanged="ReviewList_SelectionChanged" HorizontalAlignment="Stretch" Visibility="Visible" >

    <ListBox.ItemTemplate> <DataTemplate>  ......

    And I the define the template as a custom control, but when I attempt to bind data to the control using the following statement, it fails:

     

    <SL2CBControls:StarRatingControl Margin="-9,6,120,0" Name="{Binding UserName}" RenderTransformOrigin="0.5,0.5" x:Name="StarRating" VerticalAlignment="Top" Height="36" />

     

     but binding to a standard TextBlock succeeds. I have also tried to place a Grid, with a few different standard control in to the Template, and they all succeed, but binding to my custom control with a public accessible member causes Silverlight to crash, even alongside the grid and standard templates.

     

    Any help woul be appreciated.

     

    Many Thanks

     

    Thursday, November 13, 2008 11:40 AM

Answers