Пример #1
0
        /// <summary>
        /// Propertieses the field. - Реквезит полей
        /// </summary>
        /// <returns>The field.</returns>
        /// <param name="row">Row.</param>
        /// <param name="source">Source.</param>
        /// <param name="value">Value.</param>
        /// <param name="key">Key.</param>
        /// <param name="grid">Grid.</param>
        public int PropsField(int row, Dictionary <string, string> source,
                              Dictionary <string, string> value, string key, Grid grid)
        {
            // Заголовок блока
            CreateHeaderBlockProps(row, key, grid);
            row++;

            foreach (var item in source)
            {
                // Если такого поля нет в результатах
                if (!value.ContainsKey(item.Key))
                {
                    continue;
                }

                var row_Definition = new RowDefinition
                {
                    Height = new GridLength(1, GridUnitType.Auto)
                };
                grid.RowDefinitions.Add(row_Definition);

                var view_Title = new StackLayout
                {
                    BackgroundColor = Color.White,
                    Padding         = 4
                };

                var view_Caption = new StackLayout
                {
                    BackgroundColor = Color.White,
                    Padding         = 4
                };

                var text = value.First(x => x.Key == item.Key);

                var label = new StructureLabel();

                view_Title.Children.Add(label.StyleLabel(text.Value));   // Название полей
                view_Caption.Children.Add(label.StyleLabel(item.Value)); // Значение поля
                grid.Children.Add(view_Title, 0, row);
                grid.Children.Add(view_Caption, 1, row);
                row++;
            }

            return(row);
        }
Пример #2
0
        /// <summary>
        /// Creates the header block properties. - Создаем вид заголовка блока
        /// реквезита
        /// </summary>
        /// <param name="row">Row.</param>
        /// <param name="text">Text.</param>
        /// <param name="grid">Grid.</param>
        private static void CreateHeaderBlockProps(int row, string text, Grid grid)
        {
            var viewHeader = new StackLayout
            {
                BackgroundColor = Color.White,
                Padding         = 4
            };

            var label = new StructureLabel();

            var header = label.StyleLabel(text);

            header.HorizontalTextAlignment = TextAlignment.Center;

            viewHeader.Children.Add(header);
            grid.Children.Add(viewHeader, 0, row);
            Grid.SetColumnSpan(viewHeader, 2);

            grid.RowDefinitions.Add(new RowDefinition
            {
                Height = new GridLength(1, GridUnitType.Auto)
            });
        }