导航

silverlight列表控件ComboBox 托管代码绑订数据集合

Posted on 2015-12-10 14:19  颍川小哥  阅读(165)  评论(0编辑  收藏  举报

 

.xaml

<ComboBox x:Name="myCombobox" Width="300" Height="30">
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Width="260" Orientation="Horizontal">
<TextBlock Text="{Binding ID}"/>
<TextBlock Text="."/>
<TextBlock Text="{Binding Name}"/>
<TextBlock Text="("/>
<TextBlock Text="{Binding Count}" Foreground="Red"/>
<TextBlock Text=")"/>
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>

</ComboBox>

 

 

 

.cs

namespace SilverlightApplication2
{
public class Category
{
public int ID { get; set; }
public string Name { get; set; }
public int Count { get; set; }


}

}