Click here to Skip to main content
15,892,768 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi friend

i have one list view in form,but in wpf dont have imagelist for use items with image, and just add text items without image, in windowform application can add items with image like this code :

listview1.items.add(textbox1.text, 0);

can help me to add items with image in wpf form like this image?????

http://oi58.tinypic.com/mud5kz.jpg[^]
Posted

1 solution

You will need to create a data template, and then set the item template property of the list view, like this:

<window.resources>
 <datatemplate x:key="ImageCell" xmlns:x="#unknown">
        <stackpanel orientation="Horizontal">
            <image source="{Binding PlayerCardImages}" width="200" height="200" stretch="Fill" tooltip="Add tooltip" />
        </stackpanel>
    </datatemplate>
</window.resources>

 <stackpanel orientation="Vertical">
 <label content="Player Cards" />
        <listview name="lvwTitles" itemssource="{Binding}">
 IsSynchronizedWithCurrentItem="True" 
 SelectionMode="Single" ItemTemplate="{StaticResource ImageCell}" Height="59">
        </listview>
 </stackpanel>


The stack panel in the item template can have anything in it (within reason).
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900