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 https://developer.xamarin.com/guides/mac/user-interface/working-with-dialogs/#The_Open_Dialog

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.