Recent articles


Unable to get Back button in Navigation Bar in Xamarin Forms

Posted by seven.srikanth@gmail.com at 01 Dec 2017 in Article


In order to get Back button in Navigation Bar, you have to invoke the view using PushAsync. When we use PushModalAsync instead of PushAsync, the Back button won't appear.
await Navigation.PushAsync(new NavigationPage(new Login()));
The back button inside Navigation Bar will appear as below.
Thanks.

Tags: Back button; Navigation Bar; Xamarin Forms



How to make a StackLayout Scrollable?

Posted by seven.srikanth@gmail.com at 01 Dec 2017 in Article


You can make your view scrollable by using Scrollview.
Sample code below.
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"              xmlns:local="clr-namespace:WaterBookingApp"              x:Class="WaterBookingApp.Views.Main">
    <ContentPage.ToolbarItems >         <ToolbarItem Name="MenuItem1" Order="Primary" Icon="Microsoft.png" Text="Login" Priority="0" />     </ContentPage.ToolbarItems>     <ScrollView>      <StackLayout>         <StackLayout>             <StackLayout VerticalOptions="FillAndExpand">                 <Label Text="Welcome to Company!" FontSize="Large" VerticalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand" Margin="0,60,0,0"/>                 <Image x:Name="LoginIcon" Source="LoginLogo.png" Margin="0,80,0,0" />             </StackLayout>             <StackLayout>
                <StackLayout.Padding>                     <OnIdiom x:TypeArguments="Thickness">                         <OnIdiom.Phone>40,0,40,0</OnIdiom.Phone>                         <OnIdiom.Tablet>140,150,140,0</OnIdiom.Tablet>                     </OnIdiom>
                </StackLayout.Padding>                 <BoxView HeightRequest="1" Margin="0,10,0,10"  WidthRequest="1" Color="White" />                 <Label Text="Book Now" />                 <BoxView HeightRequest="1" Margin="0,10,0,10"  WidthRequest="1" Color="White" />                 <Label x:Name="LbNavigationBarl_NumberofCans" Text="Number of Cans" />                 <Picker x:Name="numberpicker" Title="Number of Cans" />
                <Label x:Name="Lbl_Address" Text="Delivery Address" />                 <Entry x:Name="Entry_Address" Text="Your Address here" />                 <Button x:Name="Btn_Book" Text="Proceed" Clicked="Btn_Book_Clicked" />             </StackLayout>         </StackLayout>     </StackLayout>     </ScrollView> </ContentPage>

Tags: Scrollview; StackLayout Scrollable; Xamarin Forms



How to draw a line in Xamarin Forms?

Posted by seven.srikanth@gmail.com at 01 Dec 2017 in Article


Often you may need to add a line between controls.
You can do this using below code. 
<BoxView HeightRequest="1" Margin="0,10,0,10"  WidthRequest="1" Color="White" />
Hope this is useful. Thanks.

Tags: draw a line; Xamarin Forms;