将图像应用于xaml中的动态数据列表框

[英]applying images to a dynamic data listbox in xaml


I'm new to xaml and wpf. I actually wanted to create a dynamic listbox populating a list of customers with images ('redball' for old customers and 'greenball' for new customers) adjacent to the names in the list. The list as I mentioned will be having random number of entries. Kindly suggest me or guide me trough any samples or blogs which might be helpful.

我是xaml和wpf的新手。我实际上想创建一个动态列表框,用列表中的名称旁边的图像(旧客户的'redball'和新客户的'greenball')填充客户列表。我提到的列表将具有随机数量的条目。请建议我或通过任何可能有用的样本或博客指导我。

Thanks

1 个解决方案

#1


0  

if your customer object has a public property (IsNew or something like that) then you can simply use a datatemplate with Style.Datatrigger to show a green or red ball. if you a new to wpf you should read some books to bwecome familiar with bindings, xaml styles and so on. and if you did this you should read about mvvm pattern.

如果您的客户对象具有公共属性(IsNew或类似的东西),那么您可以简单地使用带有Style.Datatrigger的datatemplate来显示绿色或红色球。如果你是wpf的新手,你应该阅读一些书籍,以熟悉绑定,xaml样式等。如果你这样做,你应该阅读有关mvvm模式。

关注微信公众号

注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2011/12/04/ed6f9eed77a5848891e943fbb70c7feb.html



 
粤ICP备14056181号  © 2014-2020 ITdaan.com