Friday, February 10, 2017

Xamarin Forms Creating Your Own Custom Dialog

Overview


Sometimes the existing dialogs from Xamarin.forms does not conforms to what we need like custom dialog which contains some entry and ok cancel button or perhaps a listview inside a dialog that may contain complex UI, existing libraries like in this link and acr dialog doesnt give us what exactly we want in a dialog. And worst we will resort with custom renderers to achieve this.

So i made a custom dialog made purely in xaml without custom renderer. Yes you read it right its pure xaml, you can check the full source code here.





How to use


Just copy the source implementation of PopUpDialogView just like you see in the screen below, you can customize it to conform with your design Or may add another animation transition during show and hide.






Adding PopUpDialogView in your page is simple, you will  need to add a Grid Layout without rows and columns, please take a look at the code below.


- -


Wrapping Up


You can check the full source here, For more about Xamarin.Forms you can always check their site and if you want something fresh you can check their blog. If you have questions please feel free to comment just below this article.










7 comments:

  1. 'View' is a namespace but is used like a type - go this compilation error for the Code Behind.

    ReplyDelete
  2. 'View' is a namespace but is used like a type - Got this compilation error for the Code Behind for PopUpDialogView.xaml.cs

    ReplyDelete
  3. Create folder in your project with name views and place xaml file there, in your cs file, modify your name space to views.yourview

    ReplyDelete
  4. Nice blog and absolutely outstanding. You can do something much better but i still say this perfect.Keep trying for the best. Hire xamarin developer india, xamarin development company

    ReplyDelete
  5. This is very cool. Would there be a way to implement this in a MVVM solution?

    ReplyDelete
    Replies
    1. http://winstongubantes.blogspot.com/2018/05/revisiting-custom-dialog-in-net.html

      Delete
  6. Ok this is really cool. I never taught we can have dialog without using nuget package in xamarin forms. Tank you

    ReplyDelete