public FrameView(double width, double height, View content, bool propagateClick, double maxScale)
     : base(0, 0, width, height)
 {
     Width = width;
     Height = height;
     PropagateClick = propagateClick;
     PropagateKeypress = true;
     MaxScale = maxScale;
     Padding = 0;
     Content = Align(Fit(content));
 }
 public void Build(ProgressbarStar progressbar)
 {
     progress = new View(0, 0, Math.Min(Width, Math.Max(0, Width * progressbar.Percentage)), Height) { BackgroundColor = new Color(40, 175, 100) };
     stars = new List<ImageView>();
     stars.AddRange(progressbar.ActivatedStarPercentages().Select(
         (starPercentage) =>
         {
             return new ImageView("star_activated.png", Height, Height)
             {
                 X = (double)starPercentage * Width - Height
             };
         }
         ));
     stars.AddRange(progressbar.DeactivatedStarPercentages().Select(
         (starPercentage) =>
         {
             return new ImageView("star.png", Height, Height)
             {
                 X = (double)starPercentage * Width - Height
             };
         }
         ));
     double? lastX = null;
     int numberOfEqualX = 1;
     for (int index = 0; index < stars.Count; index++)
     {
         if (stars[index].X - lastX < double.Epsilon)
         {
             stars[index].X -= numberOfEqualX * (stars[index].Width / 2);
             numberOfEqualX++;
         }
         else
         {
             lastX = stars[index].X;
         }
     }
     Children = new List<View>();
     Children.Add(progress);
     Children.AddRange(stars);
 }
 public FrameView(double width, double height, View content, double maxScale)
     : this(width, height, content, true, maxScale)
 {
 }
 public FrameView(double width, double height, View content)
     : this(width, height, content, true, height / content.Height)
 {
 }
 public virtual void SetContent(View content)
 {
     Content = Align(Fit(content));
 }
 public View Fit(View view)
 {
     return view.Scale(System.Math.Min(InnerWidth / view.Width, Math.Min(InnerHeight / view.Height, MaxScale == 0 ? Double.MaxValue : MaxScale)));
 }
 public View Align(View view)
 {
     view.X = (InnerWidth - view.Width) / 2;
     view.Y = (InnerHeight - view.Height) / 2;
     return view;
 }
 public override void SetContent(View content)
 {
     base.SetContent(content);
     if(OnChanged != null)
     {
         OnChanged();
     }
 }