This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I looking for an example on how to include a file path in a property grid. I would like to have some sort of browse button which would show the OpenFileDialog. I also only want to display the name of the file not the whole path. |
|
|
Check out these links as starting points: http://www.mindscape.co.nz/forums/Post.aspx?ThreadID=1206&PostID=1749 http://www.mindscape.co.nz/forums/Thread.aspx?ThreadID=1202 These examples use a custom dialog but you could just as easily use an OpenFileDialog. For displaying the name of the file but not the whole path, use an IValueConverter that strips off all the path bits and returns only the name. Let us know if you need more info! |
|
|
From the OpenFileDialog you can get the .FileName, which is the complete path to the file... From the you can use Path.GetFileName (from System.IO) the will return just the filename with the extension... Use Path.GetFileNameWithoutExtension to get just the filename WITHOUT the extension and you can use Path.GetDirectoryName to get just the path of the file, but not the filename itself... The Path object offers alot of useful tools in parsing and manipulating paths and filenames... Hope this helps... Kevin Orcutt
|
|