void HandlePropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     if (e.PropertyName == "Content")
     {
         BorderRendererVisual.UpdateBackground(Element, ViewGroup);
     }
 }
 protected override void OnElementChanged(ElementChangedEventArgs <Border> e)
 {
     base.OnElementChanged(e);
     if (e.OldElement == null)
     {
         base.SetNativeControl(new LinearLayout(base.Context));
     }
     BorderRendererVisual.UpdateBackground(Element, ViewGroup);
 }
Esempio n. 3
0
        public void SetElement(VisualElement element)
        {
            var oldElement = this.Element;

            //unregister old and re-register new
            if (oldElement != null)
            {
                oldElement.PropertyChanged -= HandlePropertyChanged;
            }

            this.Element = element;
            if (this.Element != null)
            {
                //this.SetBackgroundColor(this.Element.BackgroundColor.ToAndroid());
                BorderRendererVisual.UpdateBackground(BorderElement, this);
                UpdateContent();

                this.Element.PropertyChanged += HandlePropertyChanged;
            }

            if (!isInitialized)
            {
                isInitialized = true;
                //sizes to match the forms view
                //updates properties, handles visual element properties
                Tracker = new VisualElementTracker(this);

                //add and remove children automatically
                packager = new VisualElementPackager(this);
                packager.Load();

                //TODO: this is hardcoded for now via resources, but could be bindable.

                /*SetColorSchemeResources (Resource.Color.xam_dark_blue,
                 *  Resource.Color.xam_purple,
                 *  Resource.Color.xam_gray,
                 *  Resource.Color.xam_green);*/
            }

            if (ElementChanged != null)
            {
                ElementChanged(this, new VisualElementChangedEventArgs(oldElement, this.Element));
            }
        }
Esempio n. 4
0
 protected override void OnElementChanged(ElementChangedEventArgs <Border> e)
 {
     base.OnElementChanged(e);
     BorderRendererVisual.UpdateBackground(Element, this.ViewGroup);
 }
Esempio n. 5
0
 protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     base.OnElementPropertyChanged(sender, e);
     //HandlePropertyChanged (sender, e);
     BorderRendererVisual.UpdateBackground(Element, this.ViewGroup);
 }