How to build those contorls? (3 type of controls)

AbaevDavidAbaevDavid USMember ✭✭

Hi guys. Im pretty new in Xamarin.

So i need to build a few pages, and i have a problem with understanding - how to build some controls.

1) Elements for list view. This is how i need to show result of search, or items (like store items)
If I need to use grid? Or cells? - I just dont know(((
(Or maybe Frame - because here I need rounded corners???)

2) Second is Button
Here is Image on left side and text -- this feature supported in standart button. But i need arrow on the right side

  • I need rounder corners.
  • (Its can be top corners, or bottom corners, or both of them)

And this is simple form for user.
Laso Rounded corners on top and bot elements.

Guys please help me.

Thank you.

Best Answer

Answers

  • AbaevDavidAbaevDavid USMember ✭✭

    But How i do frame with top corners is rounded and bottom corners is not?

  • AndreiMisiukevich_AndreiMisiukevich_ USMember ✭✭✭✭✭

    @AbaevDavid you can check renderers or do a trick
    Put you frame into any layout. Set IsClippedToBounds = true and shift your frame a little to bottom (TranslationY = 3)

    But i suggest to check renderers. Also you can achieve it with Image (AbsoluteLayout + Image as first child)

  • VovaKamishnikovVovaKamishnikov USMember ✭✭✭
    edited January 13

    .

  • AbaevDavidAbaevDavid USMember ✭✭

    @AndreiMisiukevich_ @AlessandroCaliaro Thank you guys.

    1 more (and last) question............

    I have My custom button

    With Gradient background

    Code:

    ======================================

    [assembly: ExportRenderer(typeof(MyButton), typeof(MyButton_IOS))]
    namespace MyProject.iOS.CustomElements
    {
       public class MyButton_IOS : ButtonRenderer
      {
    
        protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
    
            base.OnElementPropertyChanged(sender, e);
    
            if(e.PropertyName == "Type")
            {
    
    
                MyButton elem = (MyButton)Element;
                if(elem != null)
                {
                    SetNeedsDisplay();  //<<<====== THIS IS NOT HELPED (this call draw method but not refresh  how button is displayed
                }
            }
        }
    
        public override void Draw(CGRect rect)
        {
            base.Draw(rect);
            MyButton stack = (MyButton)Element;
            CGColor startColor = stack.StartColor.ToCGColor();
    
            CGColor endColor = stack.EndColor.ToCGColor();
    
            CAGradientLayer gradientLayer = new CAGradientLayer()
            {
                StartPoint = new CGPoint(0, 0.5),
                EndPoint = new CGPoint(1, 0.5)
            };
    
            gradientLayer.CornerRadius = 6;
            gradientLayer.Frame = rect;
    
    
            gradientLayer.Colors = new CGColor[] { startColor, endColor };
            NativeView.Layer.InsertSublayer(gradientLayer, 0);
    
    //here a also tried something like:    NativeView.Layer.Sublayers[0] = gradientLayer; etc....
        }
    }
    }
    

    Please help me)))) I want to change button background if 1 of properties changed

Sign In or Register to comment.