void DrawFluentEditorPlaceholder(ICanvas canvas, RectangleF dirtyRect)
        {
            if (!IsFocused && string.IsNullOrEmpty(Text))
            {
                canvas.SaveState();

                if (IsEnabled)
                {
                    canvas.FontColor = PlaceholderColor.ToGraphicsColor(Fluent.Color.Foreground.Black, Fluent.Color.Foreground.White);
                }
                else
                {
                    canvas.FontColor = new GColor(Fluent.Color.Foreground.NeutralTertiary);
                }

                canvas.FontSize = 14f;

                float margin = 8f;

                var x = dirtyRect.X + margin;
                var y = dirtyRect.Y + margin;

                var height = dirtyRect.Height;
                var width  = dirtyRect.Width;

                canvas.DrawString(Placeholder, x, y, width - margin, height, HorizontalAlignment.Left, VerticalAlignment.Top);

                canvas.RestoreState();
            }
        }
Exemple #2
0
        void DrawMaterialEntryPlaceholder(ICanvas canvas, RectangleF dirtyRect)
        {
            canvas.SaveState();

            canvas.FontColor = PlaceholderColor.ToGraphicsColor(Material.Color.Dark, Material.Color.Light);
            canvas.FontSize  = PlaceholderFontSize;

            float margin = 12f;

            var horizontalAlignment = HorizontalAlignment.Left;

            var x = dirtyRect.X + margin;

            if (FlowDirection == FlowDirection.RightToLeft)
            {
                x = dirtyRect.X;
                horizontalAlignment = HorizontalAlignment.Right;
            }

            var height = dirtyRect.Height;
            var width  = dirtyRect.Width;

            canvas.DrawString(Placeholder, x, PlaceholderY, width - margin, height, horizontalAlignment, VerticalAlignment.Top);

            canvas.RestoreState();
        }
        public override void DrawPlaceholder(RectangleF rect)
        {
            if (PlaceholderColor == null)
            {
                PlaceholderColor = UIColor.FromWhiteAlpha(0.7f, 1.0f);
            }

            PlaceholderColor.SetColor();

            DrawString(Placeholder, rect, UIFont.SystemFontOfSize(UIFont.LabelFontSize), UILineBreakMode.Clip, PlaceholderAlignment);
        }
        void DrawCupertinoEditorPlaceholder(ICanvas canvas, RectangleF dirtyRect)
        {
            if (!IsFocused && string.IsNullOrEmpty(Text))
            {
                canvas.SaveState();

                canvas.FontColor = PlaceholderColor.ToGraphicsColor(Material.Color.Black, Material.Color.White);
                canvas.FontSize  = 14f;

                float margin = 8f;

                var x = dirtyRect.X + margin;
                var y = dirtyRect.Y + margin;

                var height = dirtyRect.Height;
                var width  = dirtyRect.Width;

                canvas.DrawString(Placeholder, x, y, width - margin, height, HorizontalAlignment.Left, VerticalAlignment.Top);

                canvas.RestoreState();
            }
        }