Beispiel #1
0
        /// <summary>
        /// Updates the layout of the scrollbar.
        /// </summary>
        public override bool UpdateLayout(bool notifyParent = true)
        {
            bool defaultDisableLayoutUpdate = DisableLayoutUpdate;

            DisableLayoutUpdate = true;

            // set properties based on orientation of scrollbar
            if (AlignmentProperty.IsUndefined(this))
            {
                Alignment = Orientation == ElementOrientation.Horizontal ? ElementAlignment.Bottom : ElementAlignment.Right;
            }

            if (WidthProperty.IsUndefined(this))
            {
                OverrideWidth = Orientation == ElementOrientation.Horizontal ? Length : Breadth;
            }

            if (HeightProperty.IsUndefined(this))
            {
                OverrideHeight = Orientation == ElementOrientation.Horizontal ? Breadth : Length;
            }

            if (Orientation == ElementOrientation.Horizontal)
            {
                Handle.Alignment = ElementAlignment.Left;
            }
            else
            {
                Handle.Alignment = ElementAlignment.Top;
            }

            DisableLayoutUpdate = defaultDisableLayoutUpdate;
            return(base.UpdateLayout(notifyParent));
        }
Beispiel #2
0
        private IReportTable <ReportCell> BuildReport()
        {
            ReportCellProperty  centerAlignment = new AlignmentProperty(Alignment.Center);
            BoldProperty        bold            = new BoldProperty();
            IndentationProperty indentation     = new IndentationProperty();

            HorizontalReportSchemaBuilder <Entity> reportBuilder = new HorizontalReportSchemaBuilder <Entity>();

            reportBuilder.AddGlobalProperties(centerAlignment);

            reportBuilder
            .AddHeaderRow(string.Empty, e => e.Name)
            .AddProperties(centerAlignment);
            reportBuilder.AddRow("Age", e => e.Age)
            .AddHeaderProperties(bold);
            reportBuilder.AddRow(new EmptyCellsProvider <Entity>("Score"))
            .AddHeaderProperties(bold);
            reportBuilder.AddRow("Min. Score", e => e.MinScore)
            .AddHeaderProperties(indentation);
            reportBuilder.AddRow("Max. Score", e => e.MaxScore)
            .AddHeaderProperties(indentation);
            reportBuilder.AddRow("Avg. Score", e => e.AverageScore)
            .AddHeaderProperties(indentation)
            .AddProperties(new DecimalPrecisionProperty(2));

            return(reportBuilder.BuildSchema().BuildReportTable(this.GetData()));
        }
Beispiel #3
0
        private ReportCellProperty GetCellProperty(AttributeBase attribute)
        {
            ReportCellProperty property = null;

            switch (attribute)
            {
            case AlignmentAttribute alignmentAttribute:
                property = new AlignmentProperty(alignmentAttribute.Alignment);
                break;

            case BoldAttribute _:
                property = new BoldProperty();
                break;

            case ColorAttribute colorAttribute:
                property = new ColorProperty(colorAttribute.FontColor, colorAttribute.BackgroundColor);
                break;

            case DateTimeFormatAttribute dateTimeFormatAttribute:
                property = new DateTimeFormatProperty(dateTimeFormatAttribute.Format);
                break;

            case DecimalPrecisionAttribute decimalPrecisionAttribute:
                property = new DecimalPrecisionProperty(decimalPrecisionAttribute.Precision);
                break;

            case MaxLengthAttribute maxLengthAttribute:
                property = new MaxLengthProperty(maxLengthAttribute.MaxLength);
                break;

            case PercentFormatAttribute percentFormatAttribute:
                property = new PercentFormatProperty(percentFormatAttribute.Precision)
                {
                    PostfixText = percentFormatAttribute.PostfixText,
                };
                break;
            }

            return(property);
        }
        private IReportTable <ReportCell> BuildReport()
        {
            ReportCellProperty centerAlignment = new AlignmentProperty(Alignment.Center);
            BoldProperty       bold            = new BoldProperty();

            HorizontalReportSchemaBuilder <Entity> reportBuilder = new HorizontalReportSchemaBuilder <Entity>();

            reportBuilder.AddGlobalProperties(centerAlignment);
            reportBuilder
            .AddHeaderRow("Metrics", e => e.Name)
            .AddProperties(centerAlignment)
            .AddHeaderProperties(centerAlignment);
            reportBuilder.AddRow("Age", e => e.Age)
            .AddHeaderProperties(bold);
            reportBuilder.AddRow("Min. Score", e => e.MinScore);
            reportBuilder.AddRow("Max. Score", e => e.MaxScore);
            reportBuilder.AddRow("Avg. Score", e => e.AverageScore)
            .AddProperties(new DecimalPrecisionProperty(2));

            reportBuilder.AddComplexHeader(0, "Score", "Min. Score", "Avg. Score");
            reportBuilder.AddComplexHeaderProperties("Score", new ColorProperty(Color.Blue));

            return(reportBuilder.BuildSchema().BuildReportTable(this.GetData()));
        }
 set => SetValue(AlignmentProperty, value);