tags:

views:

543

answers:

1

Hi All,

I have a listview(lstViewOwner) which should display the folder and its files. I select the path by browsing.. once I give the path to a textbox, based on the path, it should open the folders and its files in a hierarchial way.. I mean

  • Folder1 Excel1.xls Excel2.xls Excel3.xls
  • Folder2 Excel1.xls Excel2.xls

Actually my question is 2 fold. 1. How to create a hierarchial way of displaying in the ListView(If i select the folder up one level.. it should disply the children) 2. How to open the files by clicking on it in the ListView.

This is the WPF Application and using C#.

Please help me Thanks Ramm

+1  A: 

ListView doesn't lend itself to representing hierarchical data.

You need to either:

  1. process you hierarchy first, presenting it to ListView as a flattened collection (perhaps with the name or the tag holding its place in the hierarchy).
  2. use a hierarchy aware control, such as TreeView. You could make the TreeView look like a list-view if you wanted.

For launching, assuming you want to run the associated application, you need to put a clicked/double-clicked handler for the control, this in turn should call ShellExecute with the filename selected.

Ray Hayes