How can I customize the border of stack Layout?

SuperCDSuperCD USMember ✭✭

I have created a square blocks using stack layout and have some elements inside the stack layout and now i want to customize the border color of stack layout? Can anybody let me know how can i create custom renderer for stack layout?

Best Answers

Answers

  • SuperCDSuperCD USMember ✭✭
    edited December 2015

    @adamkemp: Frame has rounded corners i need to show square. How can i get rid of frame's rounded corner ? Do i need to write custom renderer, if yes then please let me know how can i do that?

  • SuperCDSuperCD USMember ✭✭

    @adamkemp : Any sample would help ?

  • AlpeshAlpesh USMember

    StackLayout Content_stacklayout = new StackLayout
    {
    Spacing = 0, //// important
    Children = { titleGrid,
    new BoxView { HorizontalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.Gray, HeightRequest = 2 }, //// Important - I used box view to draw border.
    scrollContent },
    BackgroundColor = Color.FromRgb(39, 170, 226),
    };

  • HabibAli_SubhanHabibAli_Subhan PKMember ✭✭
    edited January 2017

    For windows, You can simply write in StackLayoutRenderer

    var border = new Border();
    border.BorderBrush = layout.BorderColor.ToBrush();
    border.BorderThickness = new Thickness(layout.BorderWidth);

    border.Child = this.Control;
    this.SetNativeControl(border);

  • MukeshKumar.3417MukeshKumar.3417 USMember ✭✭

    Hello Guys,

    I am using stack layout for left menu. I want to set image in layout background using custom render. Please suggest me that how will i achieve this in app or if you have any suggestion. You can share with me

  • Prajakta.ShindePrajakta.Shinde INUniversity ✭✭✭
    edited June 2017

    @adamkemp
    How can I add stack layout inside the frame programmatically?

  • adamkempadamkemp USInsider, Developer Group Leader mod

    Just set the Content property to your StackLayout. Here is the documentation: https://developer.xamarin.com/api/type/Xamarin.Forms.Frame/

  • Prajakta.ShindePrajakta.Shinde INUniversity ✭✭✭

    @adamkemp Thanks . I got that solution before.

  • VenkataSwamyVenkataSwamy INMember ✭✭✭

    Hi

    You can set rounded corner for any Layout or View or Cell (StackLayout, Grid, ListView)

    http://venkyxamarin.blogspot.in/2017/12/how-to-set-corner-radius-for-view.html#more

  • DhruvKanojiaDhruvKanojia USMember ✭✭

    Update, if any one stumbles upon this thread. There's a functionality now to handle where this mage goes in your Xamarin Forms Buttons.

    Documentation : https://docs.microsoft.com/en-us/dotnet/api/xamarin.forms.button.buttoncontentlayout.imageposition?view=xamarin-forms

    Implementation : https://stackoverflow.com/a/40591579/2408212

Sign In or Register to comment.