I need a help about creating custom wpf controls.I want to create a template and add this control to listbox dynamically.
I actually need something like this.
A rectangle ,a grid with single row and 2 column in the rectangle.First cell of grid contains an image,second cell will contain text.Add this control ti list box on load.Text of control is property of ListBoxMenu object.Text will bind from that object
for example
- Image1,Text1
- Image2,Text2
-
Image3,Text3
-
Add Image1 and Text1 to CustomControl then add CustomControl to
ListBox - Add Image2 and Text2 to CustomControl then add CustomControl to
ListBox - Add Image3 and Text3 to CustomControl then add CustomControl to
ListBox
This question shows code similar to what you describe. You can take that as a starting point.