windows phone 8.1 - XAML ItemsControl to repeat X number of times? -


i working in windows phone 8.1 application (non sl) , have property on viewmodel called apples has value of 3.

i want repeater draw x apples (i have image) x value of apples on viewmodel.

how can achieve in xaml? have following @ moment:

<itemscontrol grid.column="0" itemssource="{binding lives, converter={}}">     <itemscontrol.itemtemplate>         <datatemplate>             <!-- image here -->         </datatemplate>     </itemscontrol.itemtemplate> </itemscontrol> 

i guessing need somehow convert integer sort of items?

i did search on that, couldn't find obvious! appreciated.

thank you.

itemssource="{binding somenumber, converter={staticresource numbertoitemsconverter}}" 

public class numbertoitemsconverter: ivalueconverter {     public object convert(object value, type targettype, object parameter, cultureinfo culture)     {         var number = (int)value;         return enumerable.range(1, number);     }  } 

Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -