I would like to achieve same functionality that I have already done in iOS. I first create segue between viewcontroller to viewcontroller
by Ctrl-click
You can add a segue between two view controllers by Ctrl-Click
ing and dragging
from the grey area at the bottom of the source view controller to the second view controller (see image). The properties for the segue (such as the transition style) can be edited in the properties pane like any other control on the storyboard surface.
When you want to use the segue, it is easy enough:
PerformSegue ("detailSegue", this);
where detailSegue
is the segue identifer as set in the storyboard. Then in PrepareForSegue
do your initialisation:
public override void PrepareForSegue (UIStoryboardSegue segue, NSObject sender)
{
if (segue.Identifier == "detailSegue") {
SecondViewController = segue.DestinationViewController;
// do your initialisation here
}
}
Presumedly, (looking at your sample code), you'd like the initialisation for the destination view controller to be dependent on the row selected in in the table view. For that, you can either add a field to your view controller to hold the selected row, or "abuse" the sender
parameter of PerformSegue to pass the NSIndexPath through:
public override void RowSelected (UITableView tableView, NSIndexPath indexPath)
{
this.PerformSegue ("detailSegue", indexPath); // pass indexPath as sender
}
and then:
public override void PrepareForSegue (UIStoryboardSegue segue, NSObject sender)
{
var indexPath = (NSIndexPath)sender; // this was the selected row
// rest of PrepareForSegue here
}