2
Ich habe versucht, die Höhe der Fortschrittsleiste in Xamarin.forms mit PCL zu ändern. die Lösung scheint so zu sein: Xamarin forms increase ProgressBar heightÄndern der Höhe der benutzerdefinierten Fortschrittsleiste funktioniert nicht Xamarin.Forms iOS
auf Android das funktioniert gut, aber auf iOS funktioniert es nicht. ein Ratschlag?
Die Farb- und Eckenradiusänderung funktioniert!
mein Code:
using ZFBookingAid.iOS;
using CoreGraphics;
using Foundation;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UIKit;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
[assembly: ExportRenderer(typeof(ProgressBar), typeof(CustomProgressBarRenderer))]
namespace ZFBookingAid.iOS
{
public class CustomProgressBarRenderer : ProgressBarRenderer
{
protected override void OnElementChanged(
ElementChangedEventArgs<Xamarin.Forms.ProgressBar> e)
{
base.OnElementChanged(e);
Control.ProgressTintColor = Color.FromRgb(213, 176, 118).ToUIColor();// This changes the color of the progress
Control.TrackTintColor = Color.FromRgb(255, 255, 255).ToUIColor(); //color where is "no progress"
}
public override void LayoutSubviews()
{
base.LayoutSubviews();
var X = 0.5f;
var Y = 30.0f;
CGAffineTransform transform = CGAffineTransform.MakeScale(X, Y);
Control.Transform = transform;
this.ClipsToBounds = true;
this.Layer.MasksToBounds = true;
this.Layer.CornerRadius = 5; // This is for rounded corners.
}
}
}