<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Niroj Dahal</title>
    <description>The latest articles on DEV Community by Niroj Dahal (@kingleo10).</description>
    <link>https://dev.to/kingleo10</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F93871%2F14f54b75-0cbd-4b7f-a4be-aa4c52c0719c.jpeg</url>
      <title>DEV Community: Niroj Dahal</title>
      <link>https://dev.to/kingleo10</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kingleo10"/>
    <language>en</language>
    <item>
      <title>I Built PocketTracker Because I Was Tired of Guessing Where My Money Went</title>
      <dc:creator>Niroj Dahal</dc:creator>
      <pubDate>Sun, 11 Jan 2026 10:42:19 +0000</pubDate>
      <link>https://dev.to/kingleo10/i-built-pockettracker-because-i-was-tired-of-guessing-where-my-money-went-gne</link>
      <guid>https://dev.to/kingleo10/i-built-pockettracker-because-i-was-tired-of-guessing-where-my-money-went-gne</guid>
      <description>&lt;h2&gt;
  
  
  I Built PocketTracker Because I Was Tired of Guessing Where My Money Went
&lt;/h2&gt;

&lt;p&gt;I never planned to build a finance app.&lt;/p&gt;

&lt;p&gt;It started with a simple frustration:&lt;br&gt;&lt;br&gt;
I &lt;em&gt;thought&lt;/em&gt; I knew where my money was going — but at the end of every month, the numbers never added up.&lt;/p&gt;

&lt;p&gt;So instead of installing yet another expense tracker and abandoning it after a week, I decided to build something myself.&lt;/p&gt;

&lt;p&gt;That’s how &lt;strong&gt;PocketTracker&lt;/strong&gt; was born.&lt;/p&gt;

&lt;p&gt;⭐ &lt;strong&gt;Open-source on GitHub:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
👉 &lt;a href="https://github.com/solo-developer/MeroHisab" rel="noopener noreferrer"&gt;https://github.com/solo-developer/MeroHisab&lt;/a&gt;&lt;br&gt;&lt;br&gt;
&lt;em&gt;(Active development is happening on the &lt;code&gt;react-native&lt;/code&gt; branch)&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  What is PocketTracker?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;PocketTracker&lt;/strong&gt; is a simple mobile app that helps track &lt;strong&gt;income and expenses&lt;/strong&gt; — nothing more, nothing less.&lt;/p&gt;

&lt;p&gt;The idea is clarity:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What money came in?&lt;/li&gt;
&lt;li&gt;What money went out?&lt;/li&gt;
&lt;li&gt;Where do I stand right now?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;No complicated onboarding.&lt;br&gt;&lt;br&gt;
No overwhelming dashboards.&lt;br&gt;&lt;br&gt;
Just a clean, focused way to log daily financial activity.&lt;/p&gt;

&lt;p&gt;🔗 &lt;strong&gt;GitHub repository:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
&lt;a href="https://github.com/solo-developer/MeroHisab" rel="noopener noreferrer"&gt;https://github.com/solo-developer/MeroHisab&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Why I Didn’t Want Another “Smart” Finance App
&lt;/h2&gt;

&lt;p&gt;Most finance apps today try to do everything:&lt;br&gt;
budget forecasts, AI insights, subscription tracking, investment tips, and more.&lt;/p&gt;

&lt;p&gt;That’s impressive — but also exhausting.&lt;/p&gt;

&lt;p&gt;I wanted something:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Simple enough to use every day
&lt;/li&gt;
&lt;li&gt;Fast to open and log an entry
&lt;/li&gt;
&lt;li&gt;Easy to understand without thinking too much
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;PocketTracker is intentionally minimal.&lt;br&gt;&lt;br&gt;
It’s designed to build a habit, not overwhelm the user.&lt;/p&gt;




&lt;h2&gt;
  
  
  Building PocketTracker as a Solo Developer
&lt;/h2&gt;

&lt;p&gt;PocketTracker is built as a &lt;strong&gt;React Native mobile app&lt;/strong&gt; (see the &lt;code&gt;react-native&lt;/code&gt; branch in the repo).&lt;/p&gt;

&lt;p&gt;More than the tech stack, this project was about:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Turning a real personal problem into a product&lt;/li&gt;
&lt;li&gt;Designing around everyday usage instead of edge cases&lt;/li&gt;
&lt;li&gt;Actually finishing and sharing a project&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Shipping something imperfect beats never shipping at all.&lt;/p&gt;

&lt;p&gt;🔗 &lt;strong&gt;Source code:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
&lt;a href="https://github.com/solo-developer/MeroHisab" rel="noopener noreferrer"&gt;https://github.com/solo-developer/MeroHisab&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  What I Learned From This Project
&lt;/h2&gt;

&lt;p&gt;Working on PocketTracker reinforced a few important lessons for me:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Simple ideas are often the most useful
&lt;/li&gt;
&lt;li&gt;You don’t need a unique idea — just a real problem
&lt;/li&gt;
&lt;li&gt;Small, finished projects teach more than big unfinished ones
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Most importantly, it reminded me that personal projects don’t need to impress everyone. They just need to be honest and useful.&lt;/p&gt;




&lt;h2&gt;
  
  
  What’s Next for PocketTracker?
&lt;/h2&gt;

&lt;p&gt;PocketTracker isn’t “done” — and that’s okay.&lt;/p&gt;

&lt;p&gt;Some ideas I’m thinking about:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Better spending summaries&lt;/li&gt;
&lt;li&gt;Simple visual insights&lt;/li&gt;
&lt;li&gt;Improving the overall user experience&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you’d like to follow the project or contribute, feel free to check it out on GitHub:&lt;/p&gt;

&lt;p&gt;⭐ &lt;strong&gt;PocketTracker on GitHub:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
👉 &lt;a href="https://github.com/solo-developer/MeroHisab" rel="noopener noreferrer"&gt;https://github.com/solo-developer/MeroHisab&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Why I’m Sharing This on dev.to
&lt;/h2&gt;

&lt;p&gt;dev.to has always felt like a place where:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Small projects are welcome&lt;/li&gt;
&lt;li&gt;Learning in public is encouraged&lt;/li&gt;
&lt;li&gt;Progress matters more than perfection&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you’re a beginner or solo developer working on something small — ship it, share it, and talk about it.&lt;/p&gt;

&lt;p&gt;That’s how we grow.&lt;/p&gt;




&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;PocketTracker isn’t trying to change how finance works.&lt;br&gt;&lt;br&gt;
It’s just trying to answer one honest question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Where did my money go?”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you’re curious, I’d really appreciate you checking out the repo and leaving a ⭐ if you find it useful:&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://github.com/solo-developer/MeroHisab" rel="noopener noreferrer"&gt;https://github.com/solo-developer/MeroHisab&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks for reading 🙌&lt;/p&gt;




</description>
      <category>finance</category>
      <category>reactnative</category>
      <category>programming</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Xamarin Forms- Let's Build Web-like Pagination</title>
      <dc:creator>Niroj Dahal</dc:creator>
      <pubDate>Wed, 28 Jul 2021 20:49:15 +0000</pubDate>
      <link>https://dev.to/kingleo10/xamarin-forms-let-s-build-web-like-pagination-1550</link>
      <guid>https://dev.to/kingleo10/xamarin-forms-let-s-build-web-like-pagination-1550</guid>
      <description>&lt;p&gt;I was working with more than 1000 rows and had to implement pagination in Xamarin Forms. I made use of ContentView and made it reusable. We will be using &lt;strong&gt;FontAwesome&lt;/strong&gt; icons to add icons to our navigation button in pager. Let's dive into building it from scratch&lt;/p&gt;

&lt;h3&gt;
  
  
  Getting Started
&lt;/h3&gt;

&lt;p&gt;Install &lt;strong&gt;Xamarin.CommunityToolkit&lt;/strong&gt; nuget package from Nuget Package Manager in all projects of a solution . This package is used to implement &lt;strong&gt;EventToCommandBehaviour&lt;/strong&gt; and &lt;strong&gt;asynchronous Command&lt;/strong&gt; for Pagination View.&lt;/p&gt;

&lt;h2&gt;
  
  
  Building Pagination View
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Right Click on Shared Project and Add ContentView (xaml) and name it to  &lt;strong&gt;PaginationView&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;To add FontAwesome icons to our project , visit the &lt;a href="https://fontawesome.com/v5.15/how-to-use/on-the-desktop/setup/getting-started" rel="noopener noreferrer"&gt;link&lt;/a&gt; and download it. Add  downloaded files to our Shared project and set properties of those files as &lt;strong&gt;EmbeddedResource&lt;/strong&gt;. Export font in Assembly level by adding below line before namespace of PaginationView
&amp;gt;   [assembly: ExportFont("FontAwesomeSolid.otf", Alias = "FontAwesomeSolid")]&lt;/li&gt;
&lt;li&gt;In order to make this view reusable, we will declare Foreground Color of Navigation buttons, Disabled Color, Current active page and Total Number of pages as BindableProperty. Let's get this done in Code-behind of PaginationView
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;```public static readonly BindableProperty CurrentPageProperty = BindableProperty.Create(nameof(CurrentPage), typeof(int), typeof(PaginationView), defaultValue: 1, propertyChanged: CurrentPagePropertyChanged);&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    public static readonly BindableProperty PageCountProperty = BindableProperty.Create(nameof(PageCount), typeof(int), typeof(PaginationView), defaultValue: 1, propertyChanged: PageCountPropertyChanged);

    public static readonly BindableProperty DisabledColorProperty = BindableProperty.Create(nameof(DisabledColor), typeof(Color), typeof(PaginationView), defaultValue: Color.Gray, propertyChanged: OnDisabledColorPropertyChanged);


    public static readonly BindableProperty IconBackgroundColorProperty = BindableProperty.Create(nameof(IconBackgroundColor), typeof(Color), typeof(PaginationView), defaultValue: Color.Green, propertyChanged: IconBackgroundColorPropertyChanged);

   public static readonly BindableProperty OnPaginatedProperty = BindableProperty.Create(nameof(OnPaginated), typeof(IAsyncCommand&amp;lt;int&amp;gt;), typeof(PaginationView));

   private static void OnDisabledColorPropertyChanged(BindableObject bindable, object oldValue, object newValue)
    {
        ((PaginationView)bindable).SetPageNavigationValues();
    }
    private static void IconBackgroundColorPropertyChanged(BindableObject bindable, object oldValue, object newValue)
    {
        ((PaginationView)bindable).SetPageNavigationValues();
    }

    private static void PageCountPropertyChanged(BindableObject bindable, object oldValue, object newValue)
    {
        ((PaginationView)bindable).SetPageNavigationValues();
    }

    private static void CurrentPagePropertyChanged(BindableObject bindable, object oldValue, object newValue)
    {
        ((PaginationView)bindable).SetPageNavigationValues();
    }
    public Color DisabledColor
    {
        get =&amp;gt; (Color)GetValue(DisabledColorProperty);
        set =&amp;gt; SetValue(DisabledColorProperty, value);
    }

    public Color IconBackgroundColor
    {
        get =&amp;gt; (Color)GetValue(IconBackgroundColorProperty);
        set =&amp;gt; SetValue(IconBackgroundColorProperty, value);
    }

    public int CurrentPage
    {
        get =&amp;gt; (int)GetValue(CurrentPageProperty);
        set =&amp;gt; SetValue(CurrentPageProperty, value);
    }

    public int PageCount
    {
        get =&amp;gt; (int)GetValue(PageCountProperty);
        set =&amp;gt; SetValue(PageCountProperty, value);
    }

    public IAsyncCommand&amp;lt;int&amp;gt; OnPaginated
    {
        get =&amp;gt; (IAsyncCommand&amp;lt;int&amp;gt;)GetValue(OnPaginatedProperty);
        set =&amp;gt; SetValue(OnPaginatedProperty, value);
    }```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here are a couple of things going on. First we declared all the properties that are bindable and we declared backing properties for them.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Backing field must have its name same as its bindable property without 'Property' text in it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For Data binding, we need to implement &lt;strong&gt;INotifyPropertyChanged&lt;/strong&gt; in our PaginationView.&lt;/p&gt;

&lt;p&gt;We declared a bindable property named OnPaginatedProperty . This is of type &lt;strong&gt;IAsyncCommand&lt;/strong&gt; and is a callback command in view that Uses Pagination view in it. &lt;/p&gt;

&lt;p&gt;With bindable properties in place, we can now write our logic to manipulate our Pagination view   &lt;/p&gt;

&lt;p&gt;Whenever navigation reaches to first page, move to first page and navigate backwards buttons are disabled and when navigation reaches last page, move to last page and navigate forward buttons are disabled. We can achieve this logic by writing &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  private async ValueTask GetLastPageData()
    {
        if (CurrentPage == PageCount)
            return;
        CurrentPage = PageCount;
        SetPageNavigationValues();
        await ExecuteCommand();
    }

    private async ValueTask GetNextPageData()
    {
        if (CurrentPage == PageCount)
            return;
        CurrentPage += 1;
        SetPageNavigationValues();
        await ExecuteCommand();
    }

    private async ValueTask GetPreviousPageData()
    {
        if (CurrentPage == 1)
            return;
        CurrentPage -= 1;
        SetPageNavigationValues();
        await ExecuteCommand();
    }

    private async ValueTask GetFirstPageData()
    {
        if (CurrentPage == 1)
            return;
        CurrentPage = 1;
        SetPageNavigationValues();
        await ExecuteCommand();
    }

    private async Task ExecuteCommand()
    {
        if (OnPaginated != null)
            await OnPaginated.ExecuteAsync(CurrentPage);
    }

    private bool _allowPreviousPageNavigation;
    public bool AllowPreviousPageNavigation
    {
        get =&amp;gt; _allowPreviousPageNavigation;
        set
        {
            _allowPreviousPageNavigation = value;
            PreviousPageButtonForegroundColor = value ? IconBackgroundColor : DisabledColor;
            OnPropertyChanged(nameof(AllowPreviousPageNavigation));
        }
    }
    private bool _allowFirstPageNavigation;
    public bool AllowFirstPageNavigation
    {
        get =&amp;gt; _allowFirstPageNavigation;
        set
        {
            _allowFirstPageNavigation = value;

            FirstPageButtonForegroundColor = value ? IconBackgroundColor : DisabledColor;
            OnPropertyChanged(nameof(AllowFirstPageNavigation));
        }
    }

    private bool _allowNextPageNavigation;
    public bool AllowNextPageNavigation
    {
        get =&amp;gt; _allowNextPageNavigation;
        set
        {
            _allowNextPageNavigation = value;
            NextPageButtonForegroundColor = value ? IconBackgroundColor : DisabledColor;
            OnPropertyChanged(nameof(AllowNextPageNavigation));
        }
    }
    private bool _allowLastPageNavigation;
    public bool AllowLastPageNavigation
    {
        get =&amp;gt; _allowLastPageNavigation;
        set
        {
            _allowLastPageNavigation = value;
            LastPageButtonForegroundColor = value ? IconBackgroundColor : DisabledColor;
            OnPropertyChanged(nameof(AllowLastPageNavigation));
        }
    }

    private void SetPageNavigationValues()
    {
        AllowFirstPageNavigation = true;
        AllowNextPageNavigation = true;
        AllowLastPageNavigation = true;
        AllowPreviousPageNavigation = true;
        if (CurrentPage == 1)
        {
            AllowPreviousPageNavigation = false;
            AllowFirstPageNavigation = false;
        }
        if (CurrentPage == PageCount)
        {
            AllowNextPageNavigation = false;
            AllowLastPageNavigation = false;
        }
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now we just need to bind these functions to Command that gets called from our Pagination Component when we click navigation button in it. This can be achieved by initialising our commands in constructor&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   public IAsyncValueCommand MoveToFirstPageCommand { get; set; }
    public IAsyncValueCommand MoveToPreviousPageCommand { get; set; }
    public IAsyncValueCommand MoveToNextPageCommand { get; set; }
    public IAsyncValueCommand MoveToLastPageCommand { get; set; }

    public PaginationView()
    {
        InitializeComponent();
        MoveToFirstPageCommand = new AsyncValueCommand(() =&amp;gt; GetFirstPageData(), allowsMultipleExecutions: false);
        MoveToPreviousPageCommand = new AsyncValueCommand(() =&amp;gt; GetPreviousPageData(), allowsMultipleExecutions: false);
        MoveToNextPageCommand = new AsyncValueCommand(() =&amp;gt; GetNextPageData(), allowsMultipleExecutions: false);
        MoveToLastPageCommand = new AsyncValueCommand(() =&amp;gt; GetLastPageData(), allowsMultipleExecutions: false);
        BindingContext = this;
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now, lets get into design part of our ContentView.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    &amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;
   &amp;lt;ContentView xmlns="http://xamarin.com/schemas/2014/forms" 
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         x:Class="Xam.Views.Pagination.PaginationView"
            xmlns:xct="http://xamarin.com/schemas/2020/toolkit"&amp;gt;
&amp;lt;StackLayout Orientation="Horizontal" HorizontalOptions="CenterAndExpand" Margin="0,0,0,10"&amp;gt;
    &amp;lt;ImageButton HeightRequest="40" BackgroundColor="Transparent" IsEnabled="{Binding AllowFirstPageNavigation}"&amp;gt;
        &amp;lt;ImageButton.Source&amp;gt;
            &amp;lt;FontImageSource FontFamily="FontAwesomeSolid"
                  Color="{Binding FirstPageButtonForegroundColor}"
                 Glyph="&amp;amp;#xf100;"/&amp;gt;
        &amp;lt;/ImageButton.Source&amp;gt;

        &amp;lt;ImageButton.Behaviors&amp;gt;
            &amp;lt;xct:EventToCommandBehavior EventName="Clicked" Command="{Binding MoveToFirstPageCommand}"&amp;gt;&amp;lt;/xct:EventToCommandBehavior&amp;gt;
        &amp;lt;/ImageButton.Behaviors&amp;gt;
    &amp;lt;/ImageButton&amp;gt;
    &amp;lt;ImageButton HeightRequest="40" BackgroundColor="Transparent" IsEnabled="{Binding AllowPreviousPageNavigation}"&amp;gt;
        &amp;lt;ImageButton.Source&amp;gt;
            &amp;lt;FontImageSource FontFamily="FontAwesomeSolid"
                  Color="{Binding PreviousPageButtonForegroundColor}"
                 Glyph="&amp;amp;#xf104;"/&amp;gt;
        &amp;lt;/ImageButton.Source&amp;gt;
        &amp;lt;ImageButton.Behaviors&amp;gt;
            &amp;lt;xct:EventToCommandBehavior EventName="Clicked" Command="{Binding MoveToPreviousPageCommand}"&amp;gt;&amp;lt;/xct:EventToCommandBehavior&amp;gt;
        &amp;lt;/ImageButton.Behaviors&amp;gt;
    &amp;lt;/ImageButton&amp;gt;
    &amp;lt;Frame CornerRadius="20" HorizontalOptions="Start" WidthRequest="30" VerticalOptions="Center" Margin="0" Padding="10" BackgroundColor="{Binding IconBackgroundColor}"&amp;gt;
        &amp;lt;Label Text="{Binding CurrentPage}" TextColor="White" HorizontalOptions="Center" VerticalOptions="Center" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" FontAttributes="Bold" /&amp;gt;
    &amp;lt;/Frame&amp;gt;
    &amp;lt;Label Text="{Binding PageCount,StringFormat='Of {0}'}" VerticalOptions="Center" FontAttributes="Bold"&amp;gt;&amp;lt;/Label&amp;gt;
    &amp;lt;ImageButton HeightRequest="40" BackgroundColor="Transparent" IsEnabled="{Binding AllowNextPageNavigation}"&amp;gt;
        &amp;lt;ImageButton.Source&amp;gt;
            &amp;lt;FontImageSource FontFamily="FontAwesomeSolid"
                  Color="{Binding NextPageButtonForegroundColor}"
                 Glyph="&amp;amp;#xf105;"/&amp;gt;
        &amp;lt;/ImageButton.Source&amp;gt;
        &amp;lt;ImageButton.Behaviors&amp;gt;
            &amp;lt;xct:EventToCommandBehavior EventName="Clicked" Command="{Binding MoveToNextPageCommand}"&amp;gt;&amp;lt;/xct:EventToCommandBehavior&amp;gt;
        &amp;lt;/ImageButton.Behaviors&amp;gt;
    &amp;lt;/ImageButton&amp;gt;
    &amp;lt;ImageButton HeightRequest="40" BackgroundColor="Transparent" IsEnabled="{Binding AllowLastPageNavigation}"&amp;gt;
        &amp;lt;ImageButton.Source&amp;gt;
            &amp;lt;FontImageSource FontFamily="FontAwesomeSolid"
                   Color="{Binding LastPageButtonForegroundColor}"
                 Glyph="&amp;amp;#xf101;"/&amp;gt;
        &amp;lt;/ImageButton.Source&amp;gt;
        &amp;lt;ImageButton.Behaviors&amp;gt;
            &amp;lt;xct:EventToCommandBehavior EventName="Clicked" Command="{Binding MoveToLastPageCommand}"&amp;gt;&amp;lt;/xct:EventToCommandBehavior&amp;gt;
        &amp;lt;/ImageButton.Behaviors&amp;gt;
    &amp;lt;/ImageButton&amp;gt;
&amp;lt;/StackLayout&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, we are placing buttons and labels horizontally in  StackLayout and binding events and properties to it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Reusing the build ContentView
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Add xmlns in xaml and give it a name.&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;xmlns:customViews="clr-namespace:Xam.Views.Pagination" 
x:Name="Page"
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Use the component wherever required, in the page&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;customViews:PaginationView 
                    CurrentPage="{Binding Source={x:Reference Page}, Path=BindingContext.PageNumberBackingField}"
                    PageCount="{Binding Source={x:Reference Page}, Path=BindingContext.PageCountBackingField}" 
                    OnPaginated="{Binding Source={x:Reference Page}, Path=BindingContext.OnPaginatedCommand}"
                    IconBackgroundColor="Red"
                    DisabledColor="Gray"/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;OnPaginatedCommand should be of type IAsyncComand where parameter int gives us the page number we are in.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fso2gyivbjzxi8e8u4x2c.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fso2gyivbjzxi8e8u4x2c.gif" alt="Working GIF"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Resources
&lt;/h3&gt;

&lt;p&gt;You can find a link to Github repo with the code for this &lt;a href="https://github.com/solo-developer/Xamarin.Views.Pagination" rel="noopener noreferrer"&gt;post&lt;/a&gt;&lt;/p&gt;

</description>
      <category>xamarinforms</category>
    </item>
    <item>
      <title>Refactoring to improve performance</title>
      <dc:creator>Niroj Dahal</dc:creator>
      <pubDate>Mon, 07 Sep 2020 18:26:51 +0000</pubDate>
      <link>https://dev.to/kingleo10/refactoring-to-improve-performance-2adb</link>
      <guid>https://dev.to/kingleo10/refactoring-to-improve-performance-2adb</guid>
      <description>&lt;p&gt;We, as developers, get lost in getting a feature complete within a time-frame and negate performance most of the time. Currently, I am working on an application where I was requested to improve performance. A page was taking around 14-15s to get loaded. I brought it down to 4-5s although it is still a lot to wait. Here are some things that impacted performance of application and how I sorted it out&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Lazy-loading everywhere&lt;/strong&gt; &lt;br&gt;
We used &lt;strong&gt;Entity Framework&lt;/strong&gt; as &lt;strong&gt;ORM&lt;/strong&gt;. In order to process data, we had couple of &lt;strong&gt;foreach statements&lt;/strong&gt; and &lt;strong&gt;nested loops&lt;/strong&gt; . Inside loop, properties of referenced entities and collections were manipulated . Loading such datas eagerly reduced around 100 queries.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Automapper used everywhere&lt;/strong&gt;&lt;br&gt;
Automapper was used extensively in our application. Suppose we had an &lt;strong&gt;Address&lt;/strong&gt; Entity and it had reference to &lt;strong&gt;State&lt;/strong&gt; entity which further had reference to &lt;strong&gt;Province&lt;/strong&gt; entity , we mapped Address entity to &lt;strong&gt;AddressViewModel&lt;/strong&gt; using automapper. Even when I needed detail of Address entity in AddressViewModel, it would map all details of references in AddressViewModel. One way to get rid of it was to configure Automapper in a way to exclude mapping references of entity but that would cause our application to break since it was used elsewhere. Mapping only required references helped to improve performance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Selecting every fields from Database&lt;/strong&gt;&lt;br&gt;
Even if only some fields in a  table were needed, every fields were retrieved from database. Some of the columns stored large amount  of datas which resulted in weak performance. Selecting only the required fields improved performance by some margin.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Less Use of TryParse&lt;/strong&gt;&lt;br&gt;
In order to parse &lt;strong&gt;Enum&lt;/strong&gt; from string or int , code used to wrapped inside &lt;strong&gt;Try/Catch block&lt;/strong&gt; . If exception was caught, do something. Exceptions are meant to be unintentional but we depend on exceptions to perform an action. Changing those statements to use TryParse improved readability and performance slightly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Unaware of SelectMany querying pattern&lt;/strong&gt;&lt;br&gt;
Whenever we needed a reference inside collections , we did SelectMany . Our common misconception was SelectMany does a single query to database and retrieved data. Using a profiler showed more number of queries than expected. Suppose , we had 5 items in collection and we used SelectMany to get references inside a collection, it did 5 queries where only 1 was expected. At the end, our solution was to issue a single query to required reference table.&lt;/p&gt;

&lt;p&gt;That's all for now.&lt;br&gt;
Happy Coding !!&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>tips</category>
      <category>welcome</category>
    </item>
  </channel>
</rss>
