Forum Libraries, Components, and Plugins
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Configure Xamarin Forms Essentials Sharing dialog in iOS

Hi

This is about the UI dialog shown when sharing/launching using Xamarin Essentials in Xamarin Forms in an iOS app.

I'm tasked with converting a Xamarin native iOS/android app into Xamarin forms. The Forms app is 99% completed, with only this question remaining.

In the native iOS app, when sharing a document, we use this code and have the corresponding experience (see pic):
THIS IS THE DESIRED EXPERIENCE WITH THE QUICK LOOK ICON
UIView presentingView = UIApplication.SharedApplication.KeyWindow.RootViewController.View;
var previewController = new UIDocumentInteractionController()
{
Name = path,
Url = NSUrl.FromFilename(path),
Delegate = new DocumentInteractionDelegate(Parent)
};
previewController.PresentOptionsMenu(CGRect.Empty, presentingView, true);

THIS IS THE DESIRED EXPERIENCE WITH THE QUICK LOOK ICON


In the new forms app using Xamarin Essentials, I have tried the following but neither provide the experience required (Quick Look) by the business (see pics):
Using Share:
await Share.RequestAsync(new ShareFileRequest
{
Title = title,
File = new ShareFile(file)
});


Using Launcher:
await Launcher.OpenAsync(new OpenFileRequest { File = new ReadOnlyFile(file) });


Part of the requirement in this conversion is the UI and experience shouldn't change. Is there way to configure Essentials Share or Launcher to have the Quick Look icon? Or some workaround?

Thanks in advance!


Xamarin Forms Nuget 4.8.0.1269
Xamarin Essentials Nuget 1.5.3.2
Microsoft Visual Studio Enterprise 2019
Version 16.5.4
VisualStudio.16.Release/16.5.4+30011.22
Installed Version: Enterprise
Xamarin 16.5.000.533 ([email protected])
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin.iOS and Xamarin.Mac SDK 13.16.0.13 (b75deaf)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Best Answer

Answers

  • chrisOHchrisOH Member ✭✭

    @LandLu said:
    This quick look feature comes from the delegate you set there:
    ```
    public class DocumentInteractionDelegate : UIDocumentInteractionControllerDelegate

    Thanks @LandLu! I was hoping to avoid coding in the native iOS project (I'm not strong there) but was able to get it working by following your instruction.

Sign In or Register to comment.