[DevExpress Support Team: the issue is extracted from the T113812 ticket]
Hi,
Could you please add a FullName property to the IFileInfo interface, because now it is only possible to get separate Name and DirectoryName values. And IFileInfo cannot be converted to FileInfo.
Thanks
Hi Anton,
Would you please describe your ultimate goal in greater detail? Why is it necessary to you to introduce the FullName property while all functions required for working with a file (e.g. Open(), Delete(), Create()) are already present in the IFileInfo interface?
As for the second question, since .NET has no common file interface for both WPF and Silverlight, IFileInfo is implemented as an independent interface for both these technologies. That's why it is incompatible with the standard FileInfo class. However, you can implement this functionality manually in a IFileInfo descendant.
I am looking forward to your feedback.
I agree with Anton Rau - it seems odd that the full path and file name is not available more easily. The debugger shows the file info object within the File (or Files) property of the dialogue, but it is unreasonably hard to get at. Surely one of the first things anyone wants from an open-file dialogue is, quite simply, the full path and file name - that is what the dialogue box is for, after all. Having to write some derived special class just to do this seems well OTT.
Hello Edgar,
Thank you for sharing your opinion with us. We do not have plans to add this property to the IFileInfo interface in the near future, and you need to use the combination of the DirectoryName and Name properties instead.
As a possible solution, you can create a corresponding extension:
public static class FileInfoExtensions { public static string GetFullName(this IFileInfo fileInfo) { if(fileInfo != null) { return fileInfo.DirectoryName + "\\"+ fileInfo.Name; } else { return string.Empty; } } }
and use it to retrieve a full file name:
IFileInfo file = OpenFileDialogService.Files.First(); var ResultFileName = file.GetFullName();
If we decide to add this property, we will post corresponding information on our website. Please stay tuned to our announcements.
Thanks,
Andrey
I know this is an old post, but something's changed for the positive. This works for me. I can convert a MVVM.IFileInfo to a System.IO.FileInfo.
( ( DevExpress.Mvvm.UI.FileInfoWrapper )this.FileDialogService.File ).FileInfo and then I am able to access the IO.FileInfo properties.
Hope it helps someone else!
Hello,
Thank you for sharing this information. I agree that it can help other customers.
Just in case, we implemented the GetFullName extension method (this method is a part of the DevExpress.Mvvm.FileInfoExtensions class) for the IFileInfo interface in the context of this thread: T262161 - Add the FullPath property to the IFileInfo interface. I posted a corresponding Answer in this thread so that other customers can find this information more easily.
Thanks,
Andrey