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

Binding collections to WrapPanel

1 Answer 102 Views
WrapPanel
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Elliotte
Top achievements
Rank 1
Elliotte asked on 23 Apr 2013, 06:36 AM
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">
        <StackPanel>
            <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}}" />
        </StackPanel>
    </DataTemplate>

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.
 

1 Answer, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 23 Apr 2013, 07:18 AM
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.

Regards,
Victor
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.
Tags
WrapPanel
Asked by
Elliotte
Top achievements
Rank 1
Answers by
Victor
Telerik team
Share this question
or