开发者

Looking for a control to repeat a certain template

开发者 https://www.devze.com 2023-02-28 20:38 出处:网络
Greetings, I\'m looking for a way in Silverlight to have a control which repeats a template for each i开发者_C百科tem bound to it.

Greetings,

I'm looking for a way in Silverlight to have a control which repeats a template for each i开发者_C百科tem bound to it.

I'll try to explain a bit better.

http://img51.imageshack.us/i/naamloosmb.png/

in the screenshot you see a few of the lessons available.

The list contains: "Zumba, Squash, Spinning, Spinning Marathon, Personal Trainer (PT) Sessies" etc Each item has a description, a picture and a button to go to the page for the corrosponding lesson.

Does anyone know if there is a control available which allows me to achieve this?

If not, how should I start to accomplish this?


Why not use a listbox and an itemtemplate?

Here is a great tutorial: http://backissues.code-magazine.com/article.aspx?quickid=112091&page=1

Basically you can use a Setter to define an item template (remember in Silverlight/WPF an item's content can be any object) with a layout inside.

E.g.

<Setter Property="ItemTemplate">
   <Setter.Value>
       <DataTemplate>
           <StackPanel Orientation="Horizontal">
              <Rectangle Height="30" Width="30"
                     Margin="2"
                     Fill="{Binding Logo}" />
              <Label Content="{Binding Name}" 
                     VerticalAlignment="Center"
                     FontSize="14" />
          </StackPanel>
       </DataTemplate>
   </Setter.Value>
</Setter>

Producing:

Looking for a control to repeat a certain template

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号