| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- using System;
- using System.Windows.Media;
- using FormulaOneApp.WinPhone.Controls;
- using Xamarin.Forms;
- using Xamarin.Forms.Platform.WinPhone;
- [assembly: ExportRenderer(typeof(FormulaOneApp.Controls.CircleImageAbstraction.CircleImage), typeof(ImageCircleRenderer))]
- namespace FormulaOneApp.WinPhone.Controls
- {
- /// <summary>
- /// ImageCircle Implementation
- /// </summary>
- public class ImageCircleRenderer : ImageRenderer
- {
- /// <summary>
- /// Used for registration with dependency service
- /// </summary>
- public static void Init()
- {
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void OnElementPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
- {
- base.OnElementPropertyChanged(sender, e);
- if (Control != null && Control.Clip == null)
- {
- var min = Math.Min(Element.Width, Element.Height) / 2.0f;
- if (min <= 0)
- return;
- Control.Clip = new EllipseGeometry
- {
- Center = new System.Windows.Point(min, min),
- RadiusX = min,
- RadiusY = min
- };
- }
- }
- }
- }
|