Binding collections to WrapPanel

Thread is closed for posting
2 posts, 0 answers
  1. Elliotte
    Elliotte avatar
    3 posts
    Member since:
    Nov 2012

    Posted 23 Apr 2013 Link to this post

    I have an observable collection of items and a date template to display some of the properties of the items.  Here is an example of the data template:
    <DataTemplate x:Key="ColorRectangleTemplate">
                <Rectangle Width="55" Height="55" Fill="{Binding Color, Converter={StaticResource ColorConverter}}"
                           Margin="0,0,2,0" DoubleTap="ColorRectangle_OnDoubleTap"
                           ToolTipService.ToolTip="Double Tap to see large tile.  Drag to image to remove from list." />
                <TextBlock HorizontalAlignment="Center" Margin="0,0,2,5" Text="{Binding Color, Converter={StaticResource HtmlColorConverter}}" />

    How can I bind the collection to the WrapPanel?  I know I can add the objects in code, but I need to use data binding.

  2. Victor
    Victor avatar
    1358 posts

    Posted 23 Apr 2013 Link to this post

    Hello Elliotte,

    Thanks for writing.
    RadWrapPanel, like any other panel in Silverlight cannot be data bound. What you need to do, is to use an ItemsControl or a derived class (such as ListBox) and use its data binding capabilities instead. All items controls have an ItemsPanel property that you can set to RadWrapPanel.

    the Telerik team
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
Back to Top