Forum Xamarin.Mac

Announcement:

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.

Is it possible to open the same window multiple times?

RobAlemRobAlem Member ✭✭

I'm trying to develop an app with Xamarin on macOs and I want to display the same window on all connected displays/monitors at the same time.
The code below kind of displays what I'm trying to accomplish. However, I'm only able to get one window showing. I know why the code below doesn't get me the desired result, but that's not my problem. **I just want to know if what I'm trying to accomplish is even possible. **

public class AppDelegate : FormsApplicationDelegate
{
    public override NSWindow MainWindow => window;
    private NSWindow window;
    private List<NSScreen> screens = new List<NSScreen>(NSScreen.Screens);

    public AppDelegate()
    {
        var style = NSWindowStyle.Borderless;
        foreach (var screen in screens)
        {
            var x = screen.VisibleFrame.GetMaxX();
            var y = screen.VisibleFrame.GetMaxY();
            var rect = new CGRect(x - 320, y - 220, 300, 200);
            window = new NSWindow(rect, style, NSBackingStore.Buffered, false);
            window.Level = NSWindowLevel.ScreenSaver;
        }
    }

    public override void DidFinishLaunching(NSNotification notification)
    {
        Forms.Forms.Init();
        LoadApplication(new App()); //App.cs and App.xaml are located in a different project
        base.DidFinishLaunching(notification);
    }
}
Sign In or Register to comment.