diff options
Diffstat (limited to 'Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs')
-rw-r--r-- | Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs | 44 |
1 files changed, 14 insertions, 30 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs index 0e762987..4a409f09 100644 --- a/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs @@ -1,12 +1,13 @@ using System; using System.Collections.Generic; using System.ComponentModel; -using Xamarin.Forms.Internals; using System.Linq; using ElmSharp; using ESize = ElmSharp.Size; using ERect = ElmSharp.Rect; using EFocusDirection = ElmSharp.FocusDirection; +using Xamarin.Forms.Internals; +using Xamarin.Forms.Platform.Tizen.Native; using Specific = Xamarin.Forms.PlatformConfiguration.TizenSpecific.VisualElement; using XFocusDirection = Xamarin.Forms.PlatformConfiguration.TizenSpecific.FocusDirection; @@ -23,13 +24,6 @@ namespace Xamarin.Forms.Platform.Tizen readonly List<EventHandler<VisualElementChangedEventArgs>> _elementChangedHandlers = new List<EventHandler<VisualElementChangedEventArgs>>(); /// <summary> - /// Handler for property changed events. - /// </summary> - PropertyChangedEventHandler _propertyChangedHandler; - - EventHandler<EventArg<VisualElement>> _batchCommittedHandler; - - /// <summary> /// Flags which control status of renderer. /// </summary> VisualElementRendererFlags _flags = VisualElementRendererFlags.None; @@ -112,7 +106,7 @@ namespace Xamarin.Forms.Platform.Tizen { get { - return this.Element; + return Element; } } @@ -183,20 +177,12 @@ namespace Xamarin.Forms.Platform.Tizen } TElement oldElement = Element; - if (oldElement != null) - { - throw new InvalidOperationException("oldElement"); - } Element = newElement; - if (_propertyChangedHandler == null) - { - _propertyChangedHandler = new PropertyChangedEventHandler(OnElementPropertyChanged); - } - if (_batchCommittedHandler == null) + if (oldElement != null) { - _batchCommittedHandler = OnBatchCommitted; + Platform.SetRenderer(oldElement, null); } // send notification @@ -283,8 +269,8 @@ namespace Xamarin.Forms.Platform.Tizen { if (Element != null) { - Element.PropertyChanged -= _propertyChangedHandler; - Element.BatchCommitted -= _batchCommittedHandler; + Element.PropertyChanged -= OnElementPropertyChanged; + Element.BatchCommitted -= OnBatchCommitted; Element.ChildAdded -= OnChildAdded; Element.ChildRemoved -= OnChildRemoved; @@ -292,8 +278,6 @@ namespace Xamarin.Forms.Platform.Tizen Element.FocusChangeRequested -= OnFocusChangeRequested; - Element.Layout(new Rectangle(0, 0, -1, -1)); - var logicalChildren = (Element as IElementController).LogicalChildren; foreach (var child in logicalChildren) { @@ -302,7 +286,7 @@ namespace Xamarin.Forms.Platform.Tizen if (Platform.GetRenderer(Element) == this) { - Platform.SetRenderer(Element, (IVisualElementRenderer)null); + Platform.SetRenderer(Element, null); } Element = default(TElement); } @@ -324,8 +308,8 @@ namespace Xamarin.Forms.Platform.Tizen { if (null != e.OldElement) { - e.OldElement.PropertyChanged -= _propertyChangedHandler; - e.OldElement.BatchCommitted -= _batchCommittedHandler; + e.OldElement.PropertyChanged -= OnElementPropertyChanged; + e.OldElement.BatchCommitted -= OnBatchCommitted; e.OldElement.ChildAdded -= OnChildAdded; e.OldElement.ChildRemoved -= OnChildRemoved; @@ -333,8 +317,6 @@ namespace Xamarin.Forms.Platform.Tizen e.OldElement.FocusChangeRequested -= OnFocusChangeRequested; - Element.Layout(new Rectangle(0, 0, -1, -1)); - var controller = e.OldElement as IElementController; if (controller != null && controller.EffectControlProvider == this) { @@ -344,8 +326,8 @@ namespace Xamarin.Forms.Platform.Tizen if (null != e.NewElement) { - e.NewElement.PropertyChanged += _propertyChangedHandler; - e.NewElement.BatchCommitted += _batchCommittedHandler; + e.NewElement.PropertyChanged += OnElementPropertyChanged; + e.NewElement.BatchCommitted += OnBatchCommitted; e.NewElement.ChildAdded += OnChildAdded; e.NewElement.ChildRemoved += OnChildRemoved; @@ -353,7 +335,9 @@ namespace Xamarin.Forms.Platform.Tizen e.NewElement.FocusChangeRequested += OnFocusChangeRequested; + (NativeView as IBatchable)?.BatchBegin(); UpdateAllProperties(true); + (NativeView as IBatchable)?.BatchCommit(); var controller = e.NewElement as IElementController; if (controller != null) |