Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/305.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 从所选行返回值_C#_Xamarin - Fatal编程技术网

C# 从所选行返回值

C# 从所选行返回值,c#,xamarin,C#,Xamarin,我当前的TableView返回五个项目。 商品:苹果、梨、香蕉、橘子、芒果 我想知道如何获取所选行的值。例如,如果我单击Apple,值将为“Apple” 如果有下划线,我想显示获取值的方法。类似于GetRowValue(indexPath)。任何帮助都将不胜感激。假设您的底层数据源是 List<Fruit> data; List<Fruit> data; public override void RowSelected(UITableView tableView, N

我当前的TableView返回五个项目。 商品:苹果、梨、香蕉、橘子、芒果

我想知道如何获取所选行的值。例如,如果我单击Apple,值将为“Apple”


如果有下划线,我想显示获取值的方法。类似于GetRowValue(indexPath)。任何帮助都将不胜感激。

假设您的底层数据源是

List<Fruit> data;
List<Fruit> data;
public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
{
    var item = data[indexPath.Row];

    HelloViewController helloView = new HelloViewController(item);
    AppDelegate appDelegate = UIApplication.SharedApplication.Delegate as AppDelegate;
    appDelegate.RootNavigationController.PushViewController(helloView, true);
}