* Pixiview.iOS/Pixiview.iOS.csproj: * Pixiview.iOS/Renderers/RoundLabelRenderer.cs: * Pixiview.iOS/Renderers/CircleImageRenderer.cs: custom round corner controls * Pixiview/App.xaml: * Pixiview/Utils/Converters.cs: * Pixiview/GlobalSuppressions.cs: * Pixiview/UI/StyleDefinition.cs: * Pixiview/UI/AdaptedPage.cs: * Pixiview.iOS/Renderers/AdaptedPageRenderer.cs: observe orientation * Pixiview/MainPage.xaml: * Pixiview/Utils/Stores.cs: * Pixiview/MainPage.xaml.cs: * Pixiview/Utils/IllustData.cs: data and UI adjust
48 lines
1.5 KiB
C#
48 lines
1.5 KiB
C#
using System.ComponentModel;
|
|
using Pixiview.iOS.Renderers;
|
|
using Pixiview.UI;
|
|
using Xamarin.Forms;
|
|
using Xamarin.Forms.Platform.iOS;
|
|
|
|
[assembly: ExportRenderer(typeof(RoundLabel), typeof(RoundLabelRenderer))]
|
|
namespace Pixiview.iOS.Renderers
|
|
{
|
|
public class RoundLabelRenderer : LabelRenderer
|
|
{
|
|
protected override void OnElementChanged(ElementChangedEventArgs<Label> e)
|
|
{
|
|
base.OnElementChanged(e);
|
|
|
|
if (Control != null && Element is RoundLabel label)
|
|
{
|
|
int radius = label.CornerRadius;
|
|
if (radius > 0)
|
|
{
|
|
Control.Layer.CornerRadius = radius;
|
|
Control.BackgroundColor = label.BackgroundColor.ToUIColor();
|
|
Control.Layer.MasksToBounds = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
|
|
{
|
|
base.OnElementPropertyChanged(sender, e);
|
|
|
|
if (e.PropertyName == RoundLabel.CornerRadiusProperty.PropertyName)
|
|
{
|
|
if (Control != null && Element is RoundLabel label)
|
|
{
|
|
int radius = label.CornerRadius;
|
|
if (radius > 0)
|
|
{
|
|
Control.Layer.CornerRadius = radius;
|
|
Control.BackgroundColor = label.BackgroundColor.ToUIColor();
|
|
Control.Layer.MasksToBounds = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|