I want to inesrt one image beside one text,like this I have to include three items in a ListBox
in run time.
If the number of items is more than 3,then the last items get removed. How can I do that in WPF,C#. And the newly added item should get add开发者_StackOverflow社区ed in first place. Now I did up to include text at runtime.
if (listBox1.Items.Count >= 3)
listBox1.Items.RemoveAt(2);
listBox1.Items.Insert(0,lData);
But I do nto know how to insert image(small rectangle with red colr,green color)
Anu, you might want to read about DataTemplate
-s (e.g. http://msdn.microsoft.com/en-us/library/ms742521.aspx) and about styling and templating in WPF in general.
精彩评论