tags:

views:

20

answers:

1

I want to inesrt one image beside one text,like this i have to include three items in 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 added 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)

A: 

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.

arconaut