示例#1
0
        public override void DestroyItem(ViewGroup container, int position, Object @object)
        {
            var dataContext = @object.DataContext();

            if (position != PositionNone)
            {
                position = GetPosition(dataContext);
            }
            bool removed  = position == PositionNone;
            var  fragment = @object as Fragment;

            if (fragment == null)
            {
                var view = (View)@object;
                container.RemoveView(view);
            }
            else
            {
                if (_currentTransaction == null)
                {
                    _currentTransaction = _fragmentManager.BeginTransaction();
                }
                if (removed)
                {
                    _currentTransaction.Remove(fragment);
                }
                else
                {
                    _currentTransaction.Detach(fragment);
                }
            }
        }
示例#2
0
        public override int GetItemPosition(Object @object)
        {
            if (ItemsSource == null)
            {
                return(PositionNone);
            }
            var dataContext = @object.DataContext();

            return(GetPosition(dataContext));
        }
 public override int GetItemPosition(Object @object)
 {
     if (ItemsSource == null)
         return PositionNone;
     var dataContext = @object.DataContext();
     return GetPosition(dataContext);
 }
 public override void DestroyItem(ViewGroup container, int position, Object @object)
 {
     var dataContext = @object.DataContext();
     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);
     }
 }
 public override void DestroyItem(ViewGroup container, int position, Object @object)
 {
     var dataContext = @object.DataContext();
     if (position != PositionNone)
         position = GetPosition(dataContext);
     bool removed = position == PositionNone;
     var fragment = @object as Fragment;
     if (fragment == null)
     {
         var view = (View)@object;
         container.RemoveView(view);
     }
     else
     {
         if (_currentTransaction == null)
             _currentTransaction = _fragmentManager.BeginTransaction();
         if (removed)
             _currentTransaction.Remove(fragment);
         else
             _currentTransaction.Detach(fragment);
     }
 }