コード例 #1
0
 public override int GetItemPosition(Object @object)
 {
     if (ItemsSource == null)
         return PositionNone;
     var dataContext = @object.GetDataContext();
     return GetPosition(dataContext);
 }
コード例 #2
0
 public override void DestroyItem(ViewGroup container, int position, Object @object)
 {
     var dataContext = @object.GetDataContext();
     if (position != PositionNone)
         position = GetPosition(dataContext);
     bool removed = position == PositionNone;
     if (removed && dataContext != null)
         ServiceProvider.AttachedValueProvider.Clear(dataContext, ContentPath);
     var fragment = @object as Fragment;
     if (fragment == null)
     {
         var view = (View)@object;
         container.RemoveView(view);
         if (removed)
             view.ClearBindingsRecursively(true, true);
     }
     else
     {
         if (_currentTransaction == null)
             _currentTransaction = _fragmentManager.BeginTransaction();
         if (removed)
             _currentTransaction.Remove(fragment);
         else
             _currentTransaction.Detach(fragment);
     }
 }