【发布时间】:2015-07-05 20:01:03
【问题描述】:
我正在使用 Windows Phone 8.1 应用程序(非 SL),我的 ViewModel 上有一个名为 Apples 的属性,其值为 3。
我想要一个中继器来绘制x Apples(我有图像),其中x 是我的ViewModel 上Apples 的值。
如何在 XAML 中实现这一点?我目前有以下内容:
<ItemsControl Grid.Column="0" ItemsSource="{Binding Lives, Converter={}}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<!-- image here -->
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
我猜我需要以某种方式将整数转换为某种项目?
【问题讨论】:
-
推荐的命名约定是使用属性名称
AppleCount表示数字,使用Apples表示集合类型