I think this is a simple question, but I have not found the answer to it.
How can I open other windows of my application from the ViewController code?
How can I close the current window from the ViewController code?
If you want to "open" a new Window, you can just instance the associated view controller and call ShowWindow:
public override void ViewDidLoad()
controller = new MySecondWindowController ();
make sure to keep the controller in scope for as long as you want the window, when it is Disposed it will close the window automatically.
NSWindowController has a Close method on it and NSWindow has a Close as well.
If you have not yet review the documentation and samples listed here https://forums.xamarin.com/discussion/comment/306182/#Comment_306182 I would consider doing so.
I can't use this with storyboard, because all my UI is a related ViewControllers, I do not have a NSWindowController. I simple create Segue from other controllers and use PrepareSegue (string segueIdentifier, sender) method.
Then I'm not sure at all what you are asking. You could create a view controller of the view you want in a new window, and root that in a new window or PrepareSegue depending on how you have it setup.
for close you can do this
if you want to close window of current ViewController
to open new window you can do that
var window = new NSWindow();
Ok @YuriKuznetsov i will try this later, thanks
Xamarin Inc., as a wholly-owned Microsoft subsidiary acting as a separate legal entity, adheres to the Microsoft Privacy Statement: Privacy & cookies