Ejemplo n.º 1
0
        protected virtual void OnElementPropertyChanged(object sender, PropertyChangedEventArgs changedProperty)
        {
            ElementPropertyChanged?.Invoke(this, changedProperty);

            // TODO hartez 2018/10/24 10:41:55 If the ItemTemplate changes from set to null, we need to make sure to clear the recyclerview pool

            if (changedProperty.Is(Xamarin.Forms.ItemsView.ItemsSourceProperty))
            {
                UpdateItemsSource();
            }
            else if (changedProperty.Is(VisualElement.BackgroundColorProperty))
            {
                UpdateBackgroundColor();
            }
            else if (changedProperty.Is(VisualElement.FlowDirectionProperty))
            {
                UpdateFlowDirection();
            }
            else if (changedProperty.IsOneOf(Xamarin.Forms.ItemsView.EmptyViewProperty,
                                             Xamarin.Forms.ItemsView.EmptyViewTemplateProperty))
            {
                UpdateEmptyView();
            }
            else if (changedProperty.Is(Xamarin.Forms.ItemsView.ItemSizingStrategyProperty))
            {
                UpdateAdapter();
            }
            else if (changedProperty.Is(Xamarin.Forms.ItemsView.HorizontalScrollBarVisibilityProperty))
            {
                UpdateHorizontalScrollBarVisibility();
            }
            else if (changedProperty.Is(Xamarin.Forms.ItemsView.VerticalScrollBarVisibilityProperty))
            {
                UpdateVerticalScrollBarVisibility();
            }
            else if (changedProperty.Is(Xamarin.Forms.ItemsView.ItemsUpdatingScrollModeProperty))
            {
                UpdateItemsUpdatingScrollMode();
            }
        }
Ejemplo n.º 2
0
 protected virtual void OnShellPropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     if (e.PropertyName == Shell.FlyoutHeaderBehaviorProperty.PropertyName)
     {
         UpdateFlyoutHeaderBehavior();
     }
     else if (e.IsOneOf(
                  Shell.FlyoutBackgroundColorProperty,
                  Shell.FlyoutBackgroundProperty,
                  Shell.FlyoutBackgroundImageProperty,
                  Shell.FlyoutBackgroundImageAspectProperty))
     {
         UpdateFlyoutBackground();
     }
     else if (e.Is(Shell.FlyoutVerticalScrollModeProperty))
     {
         UpdateVerticalScrollMode();
     }
     else if (e.IsOneOf(
                  Shell.FlyoutHeaderProperty,
                  Shell.FlyoutHeaderTemplateProperty))
     {
         UpdateFlyoutHeader();
     }
     else if (e.IsOneOf(
                  Shell.FlyoutFooterProperty,
                  Shell.FlyoutFooterTemplateProperty))
     {
         UpdateFlyoutFooter();
     }
     else if (e.IsOneOf(
                  Shell.FlyoutContentProperty,
                  Shell.FlyoutContentTemplateProperty))
     {
         UpdateFlyoutContent();
     }
 }
Ejemplo n.º 3
0
        protected virtual void OnElementPropertyChanged(object sender, PropertyChangedEventArgs changedProperty)
        {
            ElementPropertyChanged?.Invoke(this, changedProperty);

            if (changedProperty.Is(Xamarin.Forms.ItemsView.ItemsSourceProperty))
            {
                UpdateItemsSource();
            }
            else if (changedProperty.Is(Xamarin.Forms.ItemsView.ItemTemplateProperty))
            {
                GetRecycledViewPool().Clear();
                UpdateAdapter();
            }
            else if (changedProperty.Is(VisualElement.BackgroundColorProperty))
            {
                UpdateBackgroundColor();
            }
            else if (changedProperty.Is(VisualElement.FlowDirectionProperty))
            {
                UpdateFlowDirection();
            }
            else if (changedProperty.IsOneOf(Xamarin.Forms.ItemsView.EmptyViewProperty,
                                             Xamarin.Forms.ItemsView.EmptyViewTemplateProperty))
            {
                UpdateEmptyView();
            }
            else if (changedProperty.Is(Xamarin.Forms.ItemsView.HorizontalScrollBarVisibilityProperty))
            {
                UpdateHorizontalScrollBarVisibility();
            }
            else if (changedProperty.Is(Xamarin.Forms.ItemsView.VerticalScrollBarVisibilityProperty))
            {
                UpdateVerticalScrollBarVisibility();
            }
            else if (changedProperty.Is(Xamarin.Forms.ItemsView.ItemsUpdatingScrollModeProperty))
            {
                UpdateItemsUpdatingScrollMode();
            }
        }
Ejemplo n.º 4
0
        void HandlePropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (_tracker == null)
            {
                return;
            }

            if (e.PropertyName == "Flyout" || e.PropertyName == "Detail")
            {
                UpdateControllers();
            }
            else if (e.PropertyName == Microsoft.Maui.Controls.FlyoutPage.IsPresentedProperty.PropertyName)
            {
                ToggleFlyout();
            }
            else if (e.PropertyName == Microsoft.Maui.Controls.FlyoutPage.IsGestureEnabledProperty.PropertyName)
            {
                base.PresentsWithGesture = this.FlyoutPage.IsGestureEnabled;
            }
            else if (e.PropertyName == VisualElement.BackgroundColorProperty.PropertyName || e.PropertyName == VisualElement.BackgroundProperty.PropertyName)
            {
                UpdateBackground();
            }
            else if (e.PropertyName == VisualElement.FlowDirectionProperty.PropertyName)
            {
                UpdateFlowDirection();
            }
            else if (e.Is(Microsoft.Maui.Controls.FlyoutPage.FlyoutLayoutBehaviorProperty))
            {
                UpdateFlyoutLayoutBehavior(base.View.Bounds.Size);
            }

#pragma warning disable CS0618 // Type or member is obsolete
            MessagingCenter.Send <IVisualElementRenderer>(this, NavigationRenderer.UpdateToolbarButtons);
#pragma warning restore CS0618 // Type or member is obsolete
        }
Ejemplo n.º 5
0
        protected virtual void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (this.IsDisposed())
            {
                return;
            }

            ElementPropertyChanged?.Invoke(this, e);

            if (Control?.LayoutParameters == null && _hasLayoutOccurred)
            {
                return;
            }


            if (e.PropertyName == Frame.HasShadowProperty.PropertyName)
            {
                UpdateShadow();
            }
            else if (e.PropertyName == VisualElement.BackgroundColorProperty.PropertyName)
            {
                UpdateBackgroundColor();
            }
            else if (e.PropertyName == Frame.CornerRadiusProperty.PropertyName)
            {
                UpdateCornerRadius();
            }
            else if (e.PropertyName == Frame.BorderColorProperty.PropertyName)
            {
                UpdateBorderColor();
            }
            else if (e.Is(Xamarin.Forms.Layout.IsClippedToBoundsProperty))
            {
                UpdateClippedToBounds();
            }
        }
Ejemplo n.º 6
0
 void ConnectionPropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     if (e.Is("IsConnected"))
     {
         var now = Connection.IsConnected;
         if (!_isConnectedLast && now)
         {
             // Connected - construct model container
             _modelContainer = new SpringContainer();
             _modelContainer.Add <IStorage>(Connection.Storage);
             _modelContainer.Add <PageViewModelCache, PageViewModelCache>();
             PageViewModel.Subscribe(Storage);
             _currentPage = PageViewModelCache.Get(RootPage, null);
             OnPropertyChanged(null);
         }
         else if (_isConnectedLast && !now)
         {
             // Disconnected
             _modelContainer = null;
             OnPropertyChanged(null);
         }
         _isConnectedLast = now;
     }
 }
Ejemplo n.º 7
0
        protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs changedProperty)
        {
            base.OnElementPropertyChanged(sender, changedProperty);

            if (changedProperty.Is(Microsoft.Maui.Controls.ItemsView.ItemsSourceProperty))
            {
                UpdateItemsSource();
            }
            else if (changedProperty.Is(Microsoft.Maui.Controls.ItemsView.ItemTemplateProperty))
            {
                UpdateLayout();
            }
            else if (changedProperty.IsOneOf(Microsoft.Maui.Controls.ItemsView.EmptyViewProperty,
                                             Microsoft.Maui.Controls.ItemsView.EmptyViewTemplateProperty))
            {
                Controller.UpdateEmptyView();
            }
            else if (changedProperty.Is(Microsoft.Maui.Controls.ItemsView.HorizontalScrollBarVisibilityProperty))
            {
                UpdateHorizontalScrollBarVisibility();
            }
            else if (changedProperty.Is(Microsoft.Maui.Controls.ItemsView.VerticalScrollBarVisibilityProperty))
            {
                UpdateVerticalScrollBarVisibility();
            }
            else if (changedProperty.Is(Microsoft.Maui.Controls.ItemsView.ItemsUpdatingScrollModeProperty))
            {
                UpdateItemsUpdatingScrollMode();
            }
            else if (changedProperty.Is(VisualElement.FlowDirectionProperty))
            {
                UpdateFlowDirection();
            }
            else if (changedProperty.Is(VisualElement.IsVisibleProperty))
            {
                UpdateVisibility();
            }
        }
Ejemplo n.º 8
0
        protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs changedProperty)
        {
            base.OnElementPropertyChanged(sender, changedProperty);

            if (changedProperty.IsOneOf(CarouselView.ItemsSourceProperty, LinearItemsLayout.ItemSpacingProperty))
            {
                UpdateItemsSource();
            }
            else if (changedProperty.Is(CarouselView.ItemTemplateProperty))
            {
                UpdateItemTemplate();
            }
            else if (changedProperty.Is(CarouselView.PeekAreaInsetsProperty))
            {
                UpdatePeekAreaInsets();
            }
            else if (changedProperty.Is(CarouselView.IsSwipeEnabledProperty))
            {
                UpdateIsSwipeEnabled();
            }
            else if (changedProperty.Is(CarouselView.IsBounceEnabledProperty))
            {
                UpdateIsBounceEnabled();
            }
            else if (changedProperty.Is(CarouselView.PositionProperty))
            {
                UpdateFromPosition();
            }
            else if (changedProperty.Is(CarouselView.CurrentItemProperty))
            {
                UpdateFromCurrentItem();
            }
            else if (changedProperty.Is(CarouselView.LoopProperty))
            {
                UpdateLoop();
            }
        }
        void HandlePropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (_renderer == null)
            {
                return;
            }

            if (e.PropertyName == Layout.IsClippedToBoundsProperty.PropertyName)
            {
                UpdateClipToBounds();
                return;
            }

            if (e.Is(Platform.RendererProperty))
            {
                _renderer.View.Invalidate();
                return;
            }

            if (_renderer.Element.Batched)
            {
                if (e.PropertyName == VisualElement.XProperty.PropertyName || e.PropertyName == VisualElement.YProperty.PropertyName || e.PropertyName == VisualElement.WidthProperty.PropertyName ||
                    e.PropertyName == VisualElement.HeightProperty.PropertyName)
                {
                    _layoutNeeded = true;
                }
                else if (e.PropertyName == VisualElement.AnchorXProperty.PropertyName || e.PropertyName == VisualElement.AnchorYProperty.PropertyName || e.PropertyName == VisualElement.ScaleProperty.PropertyName || e.PropertyName == VisualElement.ScaleXProperty.PropertyName || e.PropertyName == VisualElement.ScaleYProperty.PropertyName ||
                         e.PropertyName == VisualElement.RotationProperty.PropertyName || e.PropertyName == VisualElement.RotationXProperty.PropertyName || e.PropertyName == VisualElement.RotationYProperty.PropertyName ||
                         e.PropertyName == VisualElement.IsVisibleProperty.PropertyName || e.PropertyName == VisualElement.OpacityProperty.PropertyName ||
                         e.PropertyName == VisualElement.TranslationXProperty.PropertyName || e.PropertyName == VisualElement.TranslationYProperty.PropertyName)
                {
                    if (!_batchedProperties.Contains(e.PropertyName))
                    {
                        _batchedProperties.Add(e.PropertyName);
                    }
                }
                return;
            }

            if (e.PropertyName == VisualElement.XProperty.PropertyName || e.PropertyName == VisualElement.YProperty.PropertyName || e.PropertyName == VisualElement.WidthProperty.PropertyName ||
                e.PropertyName == VisualElement.HeightProperty.PropertyName)
            {
                MaybeRequestLayout();
            }
            else if (e.PropertyName == VisualElement.AnchorXProperty.PropertyName)
            {
                UpdateAnchorX();
            }
            else if (e.PropertyName == VisualElement.AnchorYProperty.PropertyName)
            {
                UpdateAnchorY();
            }
            else if (e.PropertyName == VisualElement.ScaleProperty.PropertyName ||
                     e.PropertyName == VisualElement.ScaleXProperty.PropertyName ||
                     e.PropertyName == VisualElement.ScaleYProperty.PropertyName)
            {
                UpdateScale();
            }
            else if (e.PropertyName == VisualElement.RotationProperty.PropertyName)
            {
                UpdateRotation();
            }
            else if (e.PropertyName == VisualElement.RotationXProperty.PropertyName)
            {
                UpdateRotationX();
            }
            else if (e.PropertyName == VisualElement.RotationYProperty.PropertyName)
            {
                UpdateRotationY();
            }
            else if (e.PropertyName == VisualElement.IsVisibleProperty.PropertyName)
            {
                UpdateIsVisible();
            }
            else if (e.PropertyName == VisualElement.OpacityProperty.PropertyName)
            {
                UpdateOpacity();
            }
            else if (e.PropertyName == VisualElement.TranslationXProperty.PropertyName)
            {
                UpdateTranslationX();
            }
            else if (e.PropertyName == VisualElement.TranslationYProperty.PropertyName)
            {
                UpdateTranslationY();
            }
            else if (e.PropertyName == VisualElement.IsEnabledProperty.PropertyName)
            {
                UpdateIsEnabled();
            }
        }