public static void SetPulsingStatus(BindableObject element, bool isPulsing)
        {
            string style = VisualAttributes.GetThemeStyle(element);

            if (style == "pending")
            {
                element.SetValue(PulsingStatusProperty, isPulsing);
            }
        }
Example #2
0
        /// <summary>
        /// Constructor for this class.
        /// It defines left button-title-right button on top
        /// </summary>
        public TitleBar()
        {
            /// Sets height to 110 according to UX guide
            HeightRequest = 110;
            /// Fills horizontally
            HorizontalOptions = LayoutOptions.FillAndExpand;
            /// Needs to only take as much as HeightRequest
            /// Do not use FillAndExpand here to keep the HeightRequest
            VerticalOptions = LayoutOptions.Start;

            /// Create a new left button
            leftButton = new Button
            {
                WidthRequest  = 167,
                HeightRequest = 94,
                /// This style is based on UX guide
                /// This style is not available in other platforms so if you want to run
                /// this app on other than Tizen, this should be removed
            };
            VisualAttributes.SetThemeStyle(leftButton, "naviframe/title_left");

            /// Add button clicked event to left
            leftButton.Clicked += LeftButton_Clicked;

            /// Create a new right button
            rightButton = new Button
            {
                WidthRequest  = 167,
                HeightRequest = 94,
                /// This style is based on UX guide
                /// This style is not available in other platforms so if you want to run
                /// this app on other than Tizen, this should be removed
            };
            VisualAttributes.SetThemeStyle(rightButton, "naviframe/title_right");

            /// Create a title label
            titleLabel = new Label
            {
                WidthRequest = 720 - (32 + 130 + 14) * 2,
                // TODO-CHECK:
                HeightRequest           = 94 /*67*/,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center,
                FontSize  = 30,
                TextColor = Color.FromHex("FFFAFAFA"),
            };
            // to meet To meet thin attribute for font, need to use custom feature
            FontFormat.SetFontWeight(titleLabel, FontWeight.Light);

            /// Add it to the layout
            Children.Add(leftButton,
                         Constraint.RelativeToParent((parent) => { return(8); }),
                         Constraint.RelativeToParent((parent) => { return((110 - 94) / 2); }));

            /// Add it to the layout
            Children.Add(rightButton,
                         Constraint.RelativeToParent((parent) => { return(720 - (167 + 8)); }),
                         Constraint.RelativeToParent((parent) => { return((110 - 94) / 2); }));

            /// Add it to the layout
            Children.Add(titleLabel,
                         Constraint.RelativeToParent((parent) => { return(32 + 130 + 14); }),
                         Constraint.RelativeToParent((parent) => { return((110 - 94) / 2); }));
        }