Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7716793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:43:16+00:00 2026-06-01T02:43:16+00:00

I am trying to create a windows explorer. I have succeeded in populating the

  • 0

I am trying to create a windows explorer.
I have succeeded in populating the treeView and listView like windows explorer, but i am having a problem opening the file on double click from the listView.

This is what i have so far:

try
        {
            //clears the collection so the listview has only the files of the folder thats clicked on
            _fileDetails.Clear();


            DirectoryInfo dirInfo = new DirectoryInfo( SelectedImagePath );
            FileInfo[] info = dirInfo.GetFiles();

            foreach (FileInfo fileInfo in info)
            {
                //adds files to the collection with its properties
                _fileDetails.Add( new Details
                {
                    FileName = fileInfo.Name,
                    Size = fileInfo.Length.ToString(),
                    DateCreated = fileInfo.CreationTime.ToString(),
                    DateModified = fileInfo.LastWriteTime.ToString(),
                    RevNumber = "?",
                    User = "?"
                } );

            }
        }

where fileDetails is my ObservableCollection.

The mouse event:

protected void HandleDoubleClick( object sender, MouseButtonEventArgs e )
    {
        DependencyObject src = ( DependencyObject )( e.OriginalSource );
        while (!( src is Control ))
            src = VisualTreeHelper.GetParent( src );
        MessageBox.Show( "*** Double clicked on a " + src.GetType().FullName +"********************" + sender.ToString() );
    }

The binding:

<ListView Height="335" HorizontalAlignment="Right" Margin="0,12,12,0" Name="fileExplorerView" VerticalAlignment="Top" Width="509" Grid.Column="1" ItemsSource="{Binding ElementName=This, Path=fileDetails}">
        <ListView.ItemContainerStyle>
            <Style TargetType="{x:Type ListViewItem}">
                <EventSetter Event="MouseDoubleClick" Handler="HandleDoubleClick"/>
            </Style>
        </ListView.ItemContainerStyle>
        <ListView.View>

            <GridView>
                <GridViewColumn Header="Name" Width="100" DisplayMemberBinding="{Binding FileName}"/>
                <GridViewColumn Header="Size" Width="100" DisplayMemberBinding="{Binding Size}"/>
                <GridViewColumn Header="Date Created" Width="100" DisplayMemberBinding="{Binding DateCreated}"/>
                <GridViewColumn Header="Time Created" Width="100" DisplayMemberBinding="{Binding DateModified}"/>
                <GridViewColumn Header="Revision Number"  Width="100" DisplayMemberBinding="{Binding RevNumber}"/>
                <GridViewColumn Header="Modified By" Width="100" DisplayMemberBinding="{Binding User}"/>

            </GridView>

        </ListView.View>
    </ListView>

Instead of the messageBox in the mouse event, i will use a process to open the files.The problem is, i cant seem to figure out how to get the path of the selected file.

Thanks

All help will be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T02:43:17+00:00Added an answer on June 1, 2026 at 2:43 am

    Something like

    var item = (FrameworkElement)sender;
    var file = (Details)item.DataContext;
    var path = file.Path; // Your Details class should save the FileInfo.FullName!
    

    (Why do you have a Details class anyway? I would just use the FileInfo object)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a file listing a la windows explorer in HTML/Javascript. As
I'm trying to create a c++ library for use on windows/MSVC. My problem is
Im trying to create a windows service with vb.net but when I run: InstallUtil.exe
I'm having a really strange problem. I'm trying to download some file and store.
I am trying to create my first Windows Service, but so sad... after I
I'm trying to create an application with Windows 7 Notification Area Flyouts , like
I've been trying to create a Windows Media Player plugin in Visual Studio 2008,
Is there a way I can create Windows firewall exceptions in VB2005? I'm trying
what i'm trying to do this this. Simply create a C# windows app that
I am trying to install mongodb on my local computer. I have windows 7

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.