Forum Xamarin.iOS


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Enquiry on doing open dialog

LtttLttt MYMember

I am going to include open dialog in my developed xamarin applications.
I had added these code in main.cs.

I get the code from

var dlg = NSOpenPanel.OpenPanel;
dlg.CanChooseFiles = true;
dlg.CanChooseDirectories = false;
dlg.AllowedFileTypes = new string[] { "txt", "html", "md", "css" };

        if (dlg.RunModal() == 1)
            // Nab the first file
            var url = dlg.Urls[0];

            if (url != null)
                var path = url.Path;

                // Create a new window to hold the text

                var newWindowController = new WindowController();

                // Load the text into the window
                var window = newWindowController.Window as MainWindow;
                window.Text = File.ReadAllText(path);
                window.RepresentedUrl = url;


But the error shown


Sign In or Register to comment.