blob: 80473a8c07342807a302e13f5545c33b56837b0b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
using System;
using Foundation;
using Xamarin.Forms.Internals;
namespace Xamarin.Forms.Platform.iOS
{
internal static class CellExtensions
{
internal static NSIndexPath GetIndexPath(this Cell self)
{
if (self == null)
throw new ArgumentNullException("self");
NSIndexPath path;
if (self.RealParent is ListView)
{
var section = 0;
var til = self.GetGroup<ItemsView<Cell>, Cell>();
if (til != null)
section = til.HeaderContent.GetIndex<ItemsView<Cell>, Cell>();
var row = self.GetIndex<ItemsView<Cell>, Cell>();
path = NSIndexPath.FromRowSection(row, section);
}
else if (self.RealParent is TableView)
{
var tmPath = self.GetPath();
path = NSIndexPath.FromRowSection(tmPath.Item2, tmPath.Item1);
}
else
throw new NotSupportedException("Unknown cell parent type");
return path;
}
}
}
|