コード例 #1
0
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            SetupNavBar(NavigationController.NavigationBar.Bounds.Size);
            SetTitlePosition(ExtendedNavigationPage.GetTitlePosition(Element), ExtendedNavigationPage.GetTitlePadding(Element), ExtendedNavigationPage.GetTitleMargin(Element), new CGRect(0, 0, Math.Max(subtitleLabel.IntrinsicContentSize.Width, titleLabel.IntrinsicContentSize.Width), (titleLabel.IntrinsicContentSize.Height + subtitleLabel.IntrinsicContentSize.Height + (subtitleLabel.IntrinsicContentSize.Height > 0.0f ? 3.0f : 0.0f))));

            System.Diagnostics.Debug.WriteLine("Preparing");
        }
コード例 #2
0
        public override void ViewDidLayoutSubviews()
        {
            base.ViewDidLayoutSubviews();
            if (lastNavBarWidth != NavigationController?.NavigationBar?.Bounds.Size.Width || lastNavBarHeight != NavigationController?.NavigationBar?.Bounds.Size.Height)
            {
                lastNavBarHeight = NavigationController?.NavigationBar?.Bounds.Size.Height ?? 0.0f;
                lastNavBarWidth  = NavigationController?.NavigationBar?.Bounds.Size.Width ?? 0.0f;
                SetupNavBar(new CGSize(lastNavBarWidth, lastNavBarHeight));
            }

            SetTitlePosition(ExtendedNavigationPage.GetTitlePosition(Element), ExtendedNavigationPage.GetTitlePadding(Element), ExtendedNavigationPage.GetTitleMargin(Element), new CGRect(0, 0, Math.Max(subtitleLabel.IntrinsicContentSize.Width, titleLabel.IntrinsicContentSize.Width), (titleLabel.IntrinsicContentSize.Height + subtitleLabel.IntrinsicContentSize.Height + (subtitleLabel.IntrinsicContentSize.Height > 0.0f ? 3.0f : 0.0f))));

            System.Diagnostics.Debug.WriteLine("didSubViews");
        }
コード例 #3
0
        private void Element_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            var page = sender as Page;

            System.Diagnostics.Debug.WriteLine(e.PropertyName);

            switch (e.PropertyName)
            {
            case Page.TitleProperty.PropertyName:
            case ExtendedNavigationPage.TitleFontProperty.PropertyName:
            case CustomPage.SubtitleProperty.PropertyName:
            case ExtendedNavigationPage.SubtitleFontProperty.PropertyName:
                SetupTextFont(titleLabel, ExtendedNavigationPage.GetTitleFont(page), ExtendedNavigationPage.GetTitleColor(page));

                SetTitlePosition(ExtendedNavigationPage.GetTitlePosition(page), ExtendedNavigationPage.GetTitlePadding(Element), ExtendedNavigationPage.GetTitleMargin(Element), new CGRect(0, 0, Math.Max(subtitleLabel.IntrinsicContentSize.Width, titleLabel.IntrinsicContentSize.Width), (titleLabel.IntrinsicContentSize.Height + subtitleLabel.IntrinsicContentSize.Height + (subtitleLabel.IntrinsicContentSize.Height > 0.0f ? 3.0f : 0.0f))));
                break;

            case ExtendedNavigationPage.TitleColorProperty.PropertyName:
                var titleColor = ExtendedNavigationPage.GetTitleColor(page);
                if (titleColor.HasValue)
                {
                    titleLabel.TextColor = titleColor.Value.ToUIColor();
                }
                break;

            case ExtendedNavigationPage.SubtitleColorProperty.PropertyName:
                var subtitleColor = ExtendedNavigationPage.GetSubtitleColor(page);
                if (subtitleColor.HasValue)
                {
                    subtitleLabel.TextColor = subtitleColor.Value.ToUIColor();
                }
                break;

            case ExtendedNavigationPage.TitlePositionProperty.PropertyName:
            case ExtendedNavigationPage.TitlePaddingProperty.PropertyName:
            case ExtendedNavigationPage.TitleMarginProperty.PropertyName:
                SetTitlePosition(ExtendedNavigationPage.GetTitlePosition(Element), ExtendedNavigationPage.GetTitlePadding(Element), ExtendedNavigationPage.GetTitleMargin(Element), new CGRect(0, 0, Math.Max(subtitleLabel.IntrinsicContentSize.Width, titleLabel.IntrinsicContentSize.Width), (titleLabel.IntrinsicContentSize.Height + subtitleLabel.IntrinsicContentSize.Height + (subtitleLabel.IntrinsicContentSize.Height > 0.0f ? 3.0f : 0.0f))));
                break;

            case ExtendedNavigationPage.GradientColorsProperty.PropertyName:
            case ExtendedNavigationPage.GradientDirectionProperty.PropertyName:
            case ExtendedNavigationPage.BarBackgroundProperty.PropertyName:
            case ExtendedNavigationPage.BarBackgroundOpacityProperty.PropertyName:
                SetupBackground();
                break;

            case ExtendedNavigationPage.HasShadowProperty.PropertyName:
                SetupShadow(ExtendedNavigationPage.GetHasShadow(page));
                break;

            case ExtendedNavigationPage.TitleBackgroundProperty.PropertyName:
                if (!string.IsNullOrEmpty(ExtendedNavigationPage.GetTitleBackground(Element)))
                {
                    titleView.BackgroundColor = UIColor.FromPatternImage(UIImage.FromBundle(ExtendedNavigationPage.GetTitleBackground(Element)));
                }
                else
                {
                    titleView.BackgroundColor = null;
                }
                break;

            case nameof(ExtendedNavigationPage.TitleBorderWidth):
                titleView.Layer.BorderWidth = ExtendedNavigationPage.GetTitleBorderWidth(Element);
                break;

            case nameof(ExtendedNavigationPage.TitleBorderCornerRadius):
                titleView.Layer.CornerRadius = ExtendedNavigationPage.GetTitleBorderCornerRadius(Element);
                break;

            case nameof(ExtendedNavigationPage.TitleBorderColor):
                titleView.Layer.BorderColor = ExtendedNavigationPage.GetTitleBorderColor(Element)?.ToCGColor() ?? UIColor.Clear.CGColor;
                break;

            case nameof(ExtendedNavigationPage.TitleFillColor):
                titleView.BackgroundColor = ExtendedNavigationPage.GetTitleFillColor(Element)?.ToUIColor() ?? UIColor.Clear;
                break;

            case nameof(CustomPage.FormattedTitle):
                if (page is ContentPage cPage)
                {
                    SetupFormattedText(titleLabel, CustomPage.GetFormattedTitle(cPage), cPage.Title);
                }
                break;
            }
        }