© Taurius Litvinavicius 2021
T. LitvinaviciusExploring Windows Presentation Foundationhttps://doi.org/10.1007/978-1-4842-6637-3_4

4. Files

Taurius Litvinavicius1  
(1)
Jonava, Lithuania
 

At some point with any interface technology, you will have a need to pick a file or to save one. With WPF, this is likely to be even more common, as it is the perfect interface for handling files.

Pick and Save

When it comes to C#, to access a file, you basically need to establish a FileStream. In a console app, you do it by providing string for the directory, but in WPF, there is a more user-friendly way. Now, you can do something custom; you can also get a third party, but the best way is to use the built-in option to do it.
<Grid>
        <Button x:Name="btpick" Click="Btpick_Click" ...

Get Exploring Windows Presentation Foundation: With Practical Applications in .NET 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.