How to customize an OpenFileDialog using nested types?

Posted by vitorbal on Stack Overflow See other posts from Stack Overflow or by vitorbal
Published on 2010-05-19T04:21:51Z Indexed on 2010/05/19 4:30 UTC
Read the original article Hit count: 281

Filed under:
|

Say I wanted to customize an OpenFileDialog and change, for example, the way the filter for file extensions work, as in the case of this question. After I pointed out to the author of said question that the OpenFileDialog is not inheritable, I got a comment with the following:

Even though the OpenFileDialog is sealed (not inheritable), you may use it as a nested type. For instance, using a property that will get the NativeDialog. Then, you write your method always using the NativeDialog property and you're done.

My question is, can someone provide me with an example code on how would I proceed on doing something like that? I'm kind of new to the concept of nested types so I'm having a hard time figuring that out by myself, and I searched around the web and couldn't find anything too concrete about it.

Thanks!

© Stack Overflow or respective owner

Related posts about c#

Related posts about windows-forms