Recent articles

How to make a StackLayout Scrollable?

Posted by at 01 Dec 2017 in Article

You can make your view scrollable by using Scrollview.
Sample code below.
<ContentPage xmlns=""              xmlns:x=""              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 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;

Toolbar not Visible in Xamarin forms?

Posted by at 30 Nov 2017 in Tutorials

Usually, in Xamarin forms we will add below code to have a toolbar on top of the View.
<ContentPage.ToolbarItems >
<ToolbarItem Name="MenuItem1" Order="Primary" Icon="Microsoft.png" Text="Item 1" Priority="0" />
<ToolbarItem Name="MenuItem2" Order="Primary" Icon="Xamarin.png" Text="Item 2" Priority="1" />
But even after adding this code if you are unable to see the Toolbar, then you must need to enable the Navigation bar for the view. You can do this as shown below.
MainPage = new NavigationPage(new MainPage());
Here I enclosed the View call with in a NavigationPage and that does the trick. 
Screenshot of the View.
Hope this helps. 

Tags: enable NavigationBar; Unable to see ToolBar