Sky Software Homepage LogicNP Software Knowledge Base And FAQ

 
Contact Product Support    SearchSearch      Subscribe to the RSS feed for this forum

HOWTO: Always show extensions for files irrespective of the OS setting

 
Subscribe to the RSS feed for this forum  Forum Index -> FolderView.Net/WPF
View previous topic :: View next topic  
Author Message
Support



Joined: 18 Jul 2005
Posts: 731

Posted: Tue Apr 21, 2009 11:53 am    Post subject: HOWTO: Always show extensions for files irrespective of the OS setting

FolderView follows the "Hide File Extensions for Known File Types" setting in Windows Explorer - if it is ON, FolderView hides the extension of a file (for example, 'notes.txt' is displayed as simply 'notes').

To force FolderView to always show the extension irrespective of the OS setting, use the following code in the NodeAdd event:

[C#]
Code:

private void fldrView_NodeAdd(object sender, FolderViewEventArgs e)
{
  // Only show extensions for non-folders belonging to the file-system
  NodeAttributes attr = e.Node.GetAttributes(NodeAttributes.FileSys | NodeAttributes.Folder);
  if ((attr & NodeAttributes.FileSys) != 0 && (attr & NodeAttributes.Folder) == 0)
  {
      e.Node.Text = e.Node.GetDisplayNameEx(DisplayNameFlags.ForParsing | DisplayNameFlags.InFolder);
  }
}

[VB.Net]
Code:
Private Sub fldrView_NodeAdd(ByVal sender As System.Object, ByVal e As LogicNP.FolderViewControl.FolderViewEventArgs) Handles fldrView.NodeAdd

' Only show extensions for non-folders belonging to the file-system
Dim attr As NodeAttributes = e.Node.GetAttributes(NodeAttributes.FileSys Or NodeAttributes.Folder)
If ((attr And NodeAttributes.FileSys) <> 0 And (attr And NodeAttributes.Folder) = 0) Then
    e.Node.Text = e.Node.GetDisplayNameEx(DisplayNameFlags.ForParsing Or DisplayNameFlags.InFolder)
End If

End Sub
Back to top
Display posts from previous:   
Forum Index -> FolderView.Net/WPF All times are GMT
Page 1 of 1

 
Jump to:  


Powered by phpBB © 2001, 2005 phpBB Group