public void SetElement(VisualElement element) { var oldElement = Element; if (oldElement != null) { oldElement.PropertyChanged -= HandlePropertyChanged; } Element = element; if (Element != null) { Element.PropertyChanged += HandlePropertyChanged; } this.RemoveAllSubviews(); _xfxVisualElementManager = new XfxVisualElementManager(); _xfxVisualElementManager.Init(this); var view = Element as XfxCardView; if (view == null) { return; } SetCardBackgroundColor(); SetElevation(); RaiseElementChanged(new VisualElementChangedEventArgs(oldElement, Element)); }
void IVisualElementRenderer.SetElement(VisualElement element) { var oldElement = Element; if (oldElement != null) { oldElement.PropertyChanged -= HandlePropertyChanged; } Element = element; if (Element != null) { Element.PropertyChanged += HandlePropertyChanged; } //sizes to match the forms view //updates properties, handles visual element properties _visualElementManager = new XfxVisualElementManager(); _visualElementManager.Init(this); UseCompatPadding = true; _defaultElevation = Elevation; _defaultCornerRadius = Radius; SetContentPadding(); SetCardRadius(); SetCardBackgroundColor(); SetCardElevation(); RaiseElementChanged(new VisualElementChangedEventArgs(oldElement, Element)); }