Posts

Showing posts with the label #macos

Interacting with file and folder dialogs in .NET MAUI using CommunityToolkit.

Image
  Interacting with file and folder dialogs in .NET MAUI using CommunityToolkit. Please, support my blog by clicking on our sponsors ad! File and folder interactions are routine for many applications, often requiring the creation of cumbersome, platform-specific code. The good news is that CommunityToolkit.Maui version 5.0 now includes enhanced FolderPicker and FileSaver classes, simplifying the process of selecting target folders and saving files across all .NET MAUI platforms. FileSaver Implementing FileSaver allows your application to present users with a user-friendly dialog for choosing a destination folder. With just a few lines of code, you can save various file types, such as documents, images, videos, and more. Example in C#: using var stream = new MemoryStream(Encoding.Default.GetBytes("Hello from the Community Toolkit!")); var fileSaveResult = await FileSaver.Default.SaveAsync("sample.txt", stream, cancellationToken); if (fileSaveResult.IsSuccess