Click here to Skip to main content
11,720,557 members (66,786 online)

Silverlight / WPF

 
GeneralRe: WPF performance on Windows XP Pin
Gerry Schmitz2-Apr-13 13:45
memberGerry Schmitz2-Apr-13 13:45 
AnswerRe: WPF performance on Windows XP Pin
Pete O'Hanlon2-Apr-13 12:09
protectorPete O'Hanlon2-Apr-13 12:09 
QuestionComboBox in a DataGrid, Binding Problem Pin
shakilahmad1232-Apr-13 1:23
membershakilahmad1232-Apr-13 1:23 
QuestionHello All. Pin
caradri1-Apr-13 23:08
membercaradri1-Apr-13 23:08 
AnswerRe: Hello All. Pin
Kenneth Haugland2-Apr-13 9:21
memberKenneth Haugland2-Apr-13 9:21 
QuestionData display issue with combo box in wpf data grid Pin
ukraju1-Apr-13 7:31
memberukraju1-Apr-13 7:31 
AnswerRe: Data display issue with combo box in wpf data grid Pin
Richard MacCutchan1-Apr-13 21:48
mvpRichard MacCutchan1-Apr-13 21:48 
QuestionGet File Path from ListView Pin
MumbleB31-Mar-13 3:44
memberMumbleB31-Mar-13 3:44 
Hi Guys, I have a nice working app in Windows Forms. I am attempting to port it to WPF and I am stuck with selecting a row and getting a value from one of the columns.

Apologies for the long code:

In Windows Forms App I do the below:

private void lstFiles_DoubleClick(object sender, EventArgs e)
{
    if (lstFiles.SelectedItems.Count != 0)
    {
        string file = lstFiles.SelectedItems[0].Text;
        openFormGeneral(file);
    }
}

In WPF .xaml:

<ListView x:Name="lstFile" Height="357" HorizontalAlignment="Left" Margin="18,144,0,0" VerticalAlignment="Top" Width="550"
          ItemsSource="{Binding songDetails}"
          MouseDoubleClick="lstFile_MouseDoubleClick"
          IsSynchronizedWithCurrentItem="True"
          SelectedItem="{Binding Path=SelectedSong}">
    <ListView.View>
        <GridView>
            <GridViewColumn CellTemplate="{StaticResource FirstCell}" Width="30" />
            <GridViewColumn Header="File Name" DisplayMemberBinding="{Binding FileName}" />
            <GridViewColumn Header="Title" DisplayMemberBinding="{Binding Title}" />
            <GridViewColumn Header="Artist" DisplayMemberBinding="{Binding Artist}" />
            <GridViewColumn Header="Album" DisplayMemberBinding="{Binding Album}" />
            <GridViewColumn Header="Set" DisplayMemberBinding="{Binding Set}" />
            <GridViewColumn Header="Genre" DisplayMemberBinding="{Binding Genre}" />
            <GridViewColumn Header="Language" DisplayMemberBinding="{Binding Language}" />
            <GridViewColumn Header="File Path" DisplayMemberBinding="{Binding FilePath}" />
        </GridView>
    </ListView.View>
</ListView>

I Populate the ListView as follows:

public class songDetails
{
public string Title { get; set; }
public string Artist { get; set; }
public string Track { get; set; }
public string Set { get; set; }
public string Album { get; set; }
public string Genre { get; set; }
public string Language { get; set; }
public string FileName { get; set; }
public string FilePath { get; set; }
}
 
public IList<songDetails> songDetail { get; set; }
 

public void AddFile(ID3Info File)
{
    lstFile.Items.Add(new
    {
        FileName = File.FileName,
        Artist = File.ID3v2Info.GetTextFrame("TPE1"),
        Title = File.ID3v2Info.GetTextFrame("TIT2"),
        Track = File.ID3v2Info.GetTextFrame("TRCK"),
        Album = File.ID3v2Info.GetTextFrame("TALB"),
        Genre = File.ID3v2Info.GetTextFrame("TCON"),
        Language = File.ID3v2Info.GetTextFrame("TLAN"),
        FilePath = File.FilePath
    });
 
    artist = File.ID3v2Info.GetTextFrame("TPE1");
    track = File.ID3v2Info.GetTextFrame("TRCK");
    set = File.ID3v2Info.GetTextFrame("TPOS");
    title = File.ID3v2Info.GetTextFrame("TIT2");
    album = File.ID3v2Info.GetTextFrame("TALB");
    genre = File.ID3v2Info.GetTextFrame("TCON");
    language = File.ID3v2Info.GetTextFrame("TLAN");
 
    InitializeComponent();
    this.DataContext = this;
}
How do I access the FilePath from the ListView with MouseDoubleClick event? Thanks in advance
Excellence is doing ordinary things extraordinarily well.

AnswerRe: Get File Path from ListView Pin
Mycroft Holmes31-Mar-13 12:39
memberMycroft Holmes31-Mar-13 12:39 
GeneralRe: Get File Path from ListView Pin
MumbleB1-Apr-13 0:34
memberMumbleB1-Apr-13 0:34 
GeneralRe: Get File Path from ListView Pin
Mycroft Holmes1-Apr-13 1:23
memberMycroft Holmes1-Apr-13 1:23 
GeneralRe: Get File Path from ListView Pin
MumbleB2-Apr-13 9:10
memberMumbleB2-Apr-13 9:10 
GeneralRe: Get File Path from ListView Pin
Mycroft Holmes2-Apr-13 12:15
memberMycroft Holmes2-Apr-13 12:15 
GeneralRe: Get File Path from ListView Pin
MumbleB3-Apr-13 7:27
memberMumbleB3-Apr-13 7:27 
QuestionCollection of User Controls Pin
Mycroft Holmes30-Mar-13 22:44
memberMycroft Holmes30-Mar-13 22:44 
AnswerRe: Collection of User Controls Pin
SledgeHammer0131-Mar-13 14:48
memberSledgeHammer0131-Mar-13 14:48 
GeneralRe: Collection of User Controls Pin
Mycroft Holmes31-Mar-13 14:55
memberMycroft Holmes31-Mar-13 14:55 
GeneralRe: Collection of User Controls Pin
SledgeHammer0131-Mar-13 15:13
memberSledgeHammer0131-Mar-13 15:13 
GeneralRe: Collection of User Controls Pin
Mycroft Holmes31-Mar-13 15:30
memberMycroft Holmes31-Mar-13 15:30 
GeneralRe: Collection of User Controls Pin
SledgeHammer0131-Mar-13 15:43
memberSledgeHammer0131-Mar-13 15:43 
GeneralRe: Collection of User Controls Pin
Mycroft Holmes31-Mar-13 15:59
memberMycroft Holmes31-Mar-13 15:59 
GeneralRe: Collection of User Controls Pin
SledgeHammer0131-Mar-13 16:20
memberSledgeHammer0131-Mar-13 16:20 
GeneralRe: Collection of User Controls Pin
Mycroft Holmes31-Mar-13 18:02
memberMycroft Holmes31-Mar-13 18:02 
QuestionWPF ComboBox With User Control Pin
Kevin Marois30-Mar-13 10:24
memberKevin Marois30-Mar-13 10:24 
AnswerRe: WPF ComboBox With User Control(This may not work.) Pin
frazzle-me30-Mar-13 10:52
memberfrazzle-me30-Mar-13 10:52 

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

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


Advertise | Privacy | Mobile
Web02 | 2.8.150901.1 | Last Updated 4 Sep 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid