コード例 #1
0
    public void SetElement (VisualElement element)
    {
      var oldElement = this.Element;

      if (oldElement != null)
        oldElement.PropertyChanged -= HandlePropertyChanged;

      this.Element = element;
      if (this.Element != null) {
        //UpdateContent ();
        this.Element.PropertyChanged += HandlePropertyChanged;
      }

      ViewGroup.RemoveAllViews ();
      //sizes to match the forms view
      //updates properties, handles visual element properties
      Tracker = new VisualElementTracker (this);

      Packager = new VisualElementPackager (this);
      Packager.Load ();

      UseCompatPadding = true;

      SetContentPadding ((int)TheView.Padding.Left, (int)TheView.Padding.Top,
        (int)TheView.Padding.Right, (int)TheView.Padding.Bottom);

      Radius = TheView.CornderRadius;
 
      this.SetCardBackgroundColor(TheView.BackgroundColor.ToAndroid ());
                
                

               
          

      if (ElementChanged != null)
        ElementChanged (this, new VisualElementChangedEventArgs (oldElement, this.Element));
    }
コード例 #2
0
        protected override void Dispose(bool disposing)
        {
            if (CheckFlagsForDisposed())
            {
                return;
            }

            _flags |= VisualElementRendererFlags.Disposed;

            if (disposing)
            {
                SetOnClickListener(null);
                SetOnTouchListener(null);

                EffectUtilities.UnregisterEffectControlProvider(this, Element);

                if (Element != null)
                {
                    Element.PropertyChanged -= _propertyChangeHandler;
                }

                if (Tracker != null)
                {
                    Tracker.Dispose();
                    Tracker = null;
                }

                if (_packager != null)
                {
                    _packager.Dispose();
                    _packager = null;
                }

                if (_gestureManager != null)
                {
                    _gestureManager.Dispose();
                    _gestureManager = null;
                }

                if (ManageNativeControlLifetime)
                {
                    int count = ChildCount;
                    for (var i = 0; i < count; i++)
                    {
                        AView child = GetChildAt(i);
                        child.Dispose();
                    }
                }

                if (Element != null)
                {
                    if (Platform.GetRenderer(Element) == this)
                    {
                        Platform.SetRenderer(Element, null);
                    }

                    Element = null;
                }
            }

            base.Dispose(disposing);
        }
コード例 #3
0
 protected void SetPackager(VisualElementPackager packager)
 {
     _packager = packager;
     packager.Load();
 }
コード例 #4
0
        protected override void Dispose(bool disposing)
        {
            if ((_flags & VisualElementRendererFlags.Disposed) != 0)
            {
                return;
            }
            _flags |= VisualElementRendererFlags.Disposed;

            if (disposing)
            {
                SetOnClickListener(null);
                SetOnTouchListener(null);

                if (Tracker != null)
                {
                    Tracker.Dispose();
                    Tracker = null;
                }

                if (_packager != null)
                {
                    _packager.Dispose();
                    _packager = null;
                }

                if (_scaleDetector != null && _scaleDetector.IsValueCreated)
                {
                    _scaleDetector.Value.Dispose();
                    _scaleDetector = null;
                }

                if (_gestureListener != null)
                {
                    _gestureListener.Dispose();
                    _gestureListener = null;
                }

                if (ManageNativeControlLifetime)
                {
                    int count = ChildCount;
                    for (var i = 0; i < count; i++)
                    {
                        AView child = GetChildAt(i);
                        child.Dispose();
                    }
                }

                RemoveAllViews();

                if (Element != null)
                {
                    Element.PropertyChanged -= _propertyChangeHandler;
                    UnsubscribeGestureRecognizers(Element);

                    if (Platform.GetRenderer(Element) == this)
                    {
                        Platform.SetRenderer(Element, null);
                    }

                    (Element as IElementController).EffectControlProvider = null;

                    Element = null;
                }
            }

            base.Dispose(disposing);
        }