Skip to main content

Apply Borders on Xamarin Forms with User Interface Elements

Hello,

Some of developer including me who start from initially stage of development Xamarin.Forms are aware how to apply Border. so I found solution and share with all developer via this blog.

Apply Border of Text or any Layout here is simple way to apply this.

Please see screen shot and In this screen shot there is a Border is available in Terms & Conditions section. We need to place some of lines of code for this.




Sample Files


Code :
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    x:Class="Spot.Views.TermsConditionPage"
    Title="Terms &amp; Conditions"
    BackgroundColor="#00000000">
    <ContentPage.Resources>
        <ResourceDictionary
            x:Name="AppDictionary">
            <Color
                x:Key="BackgroundColor">#FFFFFF</Color>
            <Color
                x:Key="BorderColor">#E1E1E1</Color>
            <Style
                x:Key="InternalViewStyle"
                TargetType="ContentView">
                <Setter
                    Property="BackgroundColor"
                    Value="{StaticResource BackgroundColor}" />
                <Setter
                    Property="VerticalOptions"
                    Value="Fill" />
                <Setter
                    Property="Padding"
                    Value="10,10,10,10">
                </Setter>
            </Style>
            <Style
                x:Key="BorderStyle"
                TargetType="ContentView">
                <Setter
                    Property="BackgroundColor"
                    Value="{StaticResource BorderColor}" />
                <Setter
                    Property="Padding"
                    Value="1,1,1,1">
                </Setter>
            </Style>
        </ResourceDictionary>
    </ContentPage.Resources>
    <StackLayout
        VerticalOptions="Start"
        HorizontalOptions="Fill"
        Padding="30,40,30,0">
        <Entry
            HorizontalTextAlignment="Start"
            Placeholder="Email"
            Keyboard="Email"
            x:Name="EmailEntry" />
        <Entry
            HorizontalTextAlignment="Start"
            Placeholder="Phone"
            Keyboard="Numeric"
            x:Name="PhoneEntry" />
        <ContentView
            Style="{StaticResource BorderStyle}">
            <StackLayout
                VerticalOptions="Start"
                Style="{StaticResource InternalViewStyle}">
                <Label
                    Text="Terms &amp; Conditions"
                    TextColor="Black"
                    HorizontalTextAlignment="Start">
                </Label>
                <ScrollView
                    HeightRequest="300"
                    Orientation="Vertical"
                    VerticalOptions="FillAndExpand">
                    <StackLayout
                        Orientation="Vertical"
                        VerticalOptions="FillAndExpand">
                        <Label
                            Text="Text here"                             Font = "14" />
                    </StackLayout>
                </ScrollView>
            </StackLayout>
        </ContentView>
        <Button
            Text="SUBMIT"
            BorderColor="Blue"
            TextColor="Blue"
            Font="Bold"
            BorderWidth="1"
            BorderRadius="3"
            HorizontalOptions="Fill"
            x:Name="NextButton"
            Clicked="OnButtonClicked" />
    </StackLayout>
</ContentPage>


Next Blog On this : https://www.dropbox.com/s/7onhxeurot4dayl/XamVideo.mov?dl=0

How to get list of application which installed in your phone and calulate how many times app is opened ? :)


Happy Coding :) 



Comments

Popular posts from this blog

"Timeouts & Waiting" function in Android Xamarin

Hello, I am here to start some of Good platform which name Xamarin , Its a Cross-Platform and its basically written in C#. First Blog for Set Timeout function  : Code : using  System . Threading ; System . Threading . Tasks . Task . Factory . StartNew (()   = >   {                 Thread . Sleep ( 5000 ) ;   //   delay   execution   for   500 0 ms }) ;

Open Webpage in Default Browser

Open webpage to default browser you need to write this code in Xamarin Andorid :) Code :  var   uri   =  Android . Net . Uri . Parse   ( " http : / / www . dharmik . me " ) ; var   intent   =   new   Intent   ( Intent . ActionView ,   uri ) ;      StartActivity   ( intent ) ;

Launch Phone Dialer in Xamarin

If you want to dial direct phone via in your application in Xamarin Android please use this code , This code is same as Andorid native code. Code:   var   uri   =  Android . Net . Uri . Parse ( " tel : 9999999999 " ) ; var   callIntent   =   new   Intent   ( Intent . ActionDial , uri ) ;     StartActivity ( callIntent ) ; For More detail prefer this URL :  https://developer.xamarin.com/recipes/android/fundamentals/intent/launch_the_phone_dialer/