Пример #1
0
        public HWHeader(string _title)
        {
            m_Header = new AbsoluteLayout
            {
                BackgroundColor      = Color.FromHex(UIConstants.NavBarColor),
                Margin               = new Thickness(0, 0, 0, 0),
                MinimumHeightRequest = 65,
                HeightRequest        = 65
            };
            Content = m_Header;

            m_lblTitle = new HWLabel
            {
                Text = _title,
                VerticalTextAlignment   = TextAlignment.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                TextColor      = Color.FromHex(UIConstants.NavBarTextColor),
                FontAttributes = FontAttributes.Bold,
                FontSize       = Device.GetNamedSize(NamedSize.Medium, typeof(Label))
            };

            AbsoluteLayout.SetLayoutFlags(m_lblTitle,
                                          AbsoluteLayoutFlags.PositionProportional);

            AbsoluteLayout.SetLayoutBounds(m_lblTitle,
                                           new Rectangle(0.5, 0.7, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
            m_Header.Children.Add(m_lblTitle);

            BoxView line = new BoxView
            {
                HeightRequest     = 1,
                Color             = Color.FromHex(UIConstants.LineColor),
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            AbsoluteLayout.SetLayoutFlags(
                line,
                AbsoluteLayoutFlags.WidthProportional);

            AbsoluteLayout.SetLayoutBounds(line,
                                           new Rectangle(0,
                                                         64.5,
                                                         1,
                                                         AbsoluteLayout.AutoSize));

            m_Header.Children.Add(line);
        }
Пример #2
0
        public HWTextEntry()
        {
            //Setup grid to hold the controls
            m_EntryGrid = new Grid
            {
                Padding           = 5,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                RowDefinitions    =
                {
                    new RowDefinition {
                        Height = new GridLength(40, GridUnitType.Absolute)  //Name
                    }
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(90, GridUnitType.Absolute)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    }
                }
            };

            m_lblTitle = new HWLabel
            {
                VerticalTextAlignment = TextAlignment.Center
            };
            m_EntryGrid.Children.Add(m_lblTitle, 0, 0);

            m_txtEntry = new Entry
            {
                Keyboard = Keyboard.Plain
            };

            m_EntryGrid.Children.Add(m_txtEntry, 1, 0);

            Content = m_EntryGrid;
        }