Click here to Skip to main content
15,887,135 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: WPF/MVVM Unit Test Questions Pin
Pete O'Hanlon6-Jan-16 21:06
mvePete O'Hanlon6-Jan-16 21:06 
GeneralRe: WPF/MVVM Unit Test Questions Pin
Mycroft Holmes7-Jan-16 12:03
professionalMycroft Holmes7-Jan-16 12:03 
GeneralRe: WPF/MVVM Unit Test Questions Pin
Pete O'Hanlon7-Jan-16 21:37
mvePete O'Hanlon7-Jan-16 21:37 
Questionwhat is the best way to save images to print in wpf Pin
neodeaths5-Jan-16 4:12
neodeaths5-Jan-16 4:12 
QuestionAdding icons to a ListView from an image list Pin
zahalul28-Dec-15 11:09
zahalul28-Dec-15 11:09 
AnswerRe: Adding icons to a ListView from an image list Pin
Richard Andrew x6428-Dec-15 14:39
professionalRichard Andrew x6428-Dec-15 14:39 
AnswerRe: Adding icons to a ListView from an image list Pin
Richard MacCutchan28-Dec-15 22:19
mveRichard MacCutchan28-Dec-15 22:19 
GeneralRe: Adding icons to a ListView from an image list Pin
zahalul30-Dec-15 9:17
zahalul30-Dec-15 9:17 
Hello,

I used the following XAML code:

XML
     <StackPanel x:Name="grd">

        <ListView x:Name="listView">
            <ListView.View>
                <GridView>
                    <GridViewColumn Header="Severity" DisplayMemberBinding="{Binding Icon}"/>
                    <GridViewColumn Header="Id" DisplayMemberBinding="{Binding Id}"/>
                    <GridViewColumn Header="Name" DisplayMemberBinding="{Binding Name}"/>
                    <GridViewColumn Header="Immagine" >
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <Image Source="{Binding ImagePath}" />
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                </GridView>
            </ListView.View>
        </ListView>
     </StackPanel>
</Window>


And the following C# code:

C#
public partial class MainWindow : Window
    {
        public class MyItem
        {
            public string Icon { get; set; }

            public int Id { get; set; }

            public string Name { get; set; }

            public string ImagePath { get; set; }       
        }

        public MainWindow()
        {
            InitializeComponent();

            MyItem Item = new MyItem();

            Item.Icon = "1";
            Item.Id = 0;
            Item.Name = "Zvika";
            Item.ImagePath = "icon1.png";
            this.listView.Items.Add(Item);
        }

     }

I also added the file icon.png to the project.
Now it works.

Regards,
Z.V

modified 30-Dec-15 21:44pm.

QuestionPassing Information to the Code behind Pin
Mycroft Holmes20-Dec-15 22:26
professionalMycroft Holmes20-Dec-15 22:26 
AnswerRe: Passing Information to the Code behind Pin
Pete O'Hanlon20-Dec-15 23:21
mvePete O'Hanlon20-Dec-15 23:21 
QuestionWhy do I need a connection string to use an Entity Framework data model? Pin
_T_C_20-Dec-15 7:23
_T_C_20-Dec-15 7:23 
RantRe: Why do I need a connection string to use an Entity Framework data model? Pin
Mycroft Holmes20-Dec-15 12:14
professionalMycroft Holmes20-Dec-15 12:14 
GeneralRe: Why do I need a connection string to use an Entity Framework data model? Pin
_T_C_20-Dec-15 13:04
_T_C_20-Dec-15 13:04 
GeneralRe: Why do I need a connection string to use an Entity Framework data model? Pin
Mycroft Holmes20-Dec-15 19:23
professionalMycroft Holmes20-Dec-15 19:23 
AnswerRe: Why do I need a connection string to use an Entity Framework data model? Pin
Gerry Schmitz20-Dec-15 18:07
mveGerry Schmitz20-Dec-15 18:07 
AnswerRe: Why do I need a connection string to use an Entity Framework data model? Pin
_T_C_21-Dec-15 7:18
_T_C_21-Dec-15 7:18 
GeneralRe: Why do I need a connection string to use an Entity Framework data model? Pin
Gerry Schmitz23-Dec-15 11:29
mveGerry Schmitz23-Dec-15 11:29 
QuestionHow do I bind based on the value selected in a list box? Pin
_T_C_19-Dec-15 15:45
_T_C_19-Dec-15 15:45 
AnswerRe: How do I bind based on the value selected in a list box? Pin
_T_C_19-Dec-15 17:59
_T_C_19-Dec-15 17:59 
SuggestionRe: How do I bind based on the value selected in a list box? Pin
Richard Deeming4-Jan-16 3:55
mveRichard Deeming4-Jan-16 3:55 
QuestionRequest for help with simple WPF Pin
_T_C_18-Dec-15 11:14
_T_C_18-Dec-15 11:14 
AnswerRe: Request for help with simple WPF Pin
Gerry Schmitz18-Dec-15 11:34
mveGerry Schmitz18-Dec-15 11:34 
GeneralRe: Request for help with simple WPF Pin
_T_C_18-Dec-15 11:53
_T_C_18-Dec-15 11:53 
GeneralRe: Request for help with simple WPF Pin
Gerry Schmitz18-Dec-15 12:08
mveGerry Schmitz18-Dec-15 12:08 
GeneralRe: Request for help with simple WPF Pin
_T_C_18-Dec-15 12:42
_T_C_18-Dec-15 12:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.