├── .gitignore ├── App.cs ├── CustomFormElements ├── BlurredFrame.cs ├── IModalHost.cs ├── ModalHostPage.cs └── ModalPage.cs ├── Pages ├── FirstPage.xaml ├── FirstPage.xaml.cs ├── PopUpPage.xaml ├── PopUpPage.xaml.cs ├── SecondPage.xaml └── SecondPage.xaml.cs ├── Properties └── AssemblyInfo.cs ├── README.md ├── TransparentModal.csproj ├── TransparentModal.sln ├── iOS ├── AppDelegate.cs ├── CustomRenderers │ ├── BlurredFrameRenderer.cs │ ├── ModalHostPageRenderer.cs │ ├── ModalPageRenderer.cs │ └── PlatformMethods.cs ├── Entitlements.plist ├── ITunesArtwork ├── ITunesArtwork@2x ├── Info.plist ├── Main.cs ├── Resources │ ├── Default-568h@2x.png │ ├── Default-Portrait.png │ ├── Default-Portrait@2x.png │ ├── Default.png │ ├── Default@2x.png │ ├── Icon-60@2x.png │ ├── Icon-60@3x.png │ ├── Icon-76.png │ ├── Icon-76@2x.png │ ├── Icon-Small-40.png │ ├── Icon-Small-40@2x.png │ ├── Icon-Small-40@3x.png │ ├── Icon-Small.png │ ├── Icon-Small@2x.png │ ├── Icon-Small@3x.png │ ├── LaunchScreen.storyboard │ └── background@2x.png ├── TransparentModal.iOS.csproj └── packages.config └── packages.config /.gitignore: -------------------------------------------------------------------------------- 1 | #Autosave files 2 | *~ 3 | 4 | #build 5 | [Oo]bj/ 6 | [Bb]in/ 7 | packages/ 8 | TestResults/ 9 | 10 | # globs 11 | Makefile.in 12 | *.DS_Store 13 | *.sln.cache 14 | *.suo 15 | *.cache 16 | *.pidb 17 | *.userprefs 18 | *.usertasks 19 | config.log 20 | config.make 21 | config.status 22 | aclocal.m4 23 | install-sh 24 | autom4te.cache/ 25 | *.user 26 | *.tar.gz 27 | tarballs/ 28 | test-results/ 29 | Thumbs.db 30 | 31 | #Mac bundle stuff 32 | *.dmg 33 | *.app 34 | 35 | #resharper 36 | *_Resharper.* 37 | *.Resharper 38 | 39 | #dotCover 40 | *.dotCover 41 | -------------------------------------------------------------------------------- /App.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Xamarin.Forms; 4 | using TransparentModal.Pages; 5 | 6 | namespace TransparentModal 7 | { 8 | public class App : Application 9 | { 10 | public App () 11 | { 12 | // Setup page navigation 13 | var navigationPage = new NavigationPage(); 14 | navigationPage.PushAsync(new FirstPage(), false); 15 | 16 | MainPage = navigationPage; 17 | } 18 | 19 | protected override void OnStart() 20 | { 21 | // Handle when your app starts 22 | } 23 | 24 | protected override void OnSleep() 25 | { 26 | // Handle when your app sleeps 27 | } 28 | 29 | protected override void OnResume() 30 | { 31 | // Handle when your app resumes 32 | } 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /CustomFormElements/BlurredFrame.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Xamarin.Forms; 3 | 4 | namespace TransparentModal.CustomFormElements 5 | { 6 | public class BlurredFrame : Frame { } 7 | } 8 | 9 | -------------------------------------------------------------------------------- /CustomFormElements/IModalHost.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using Xamarin.Forms; 4 | 5 | namespace TransparentModal.CustomFormElements 6 | { 7 | public interface IModalHost 8 | { 9 | Task DisplayPageModal(Page page); 10 | 11 | Task DisplayAlert(string title, string message, string cancel); 12 | Task DisplayAlert(string title, string message, string accept, string cancel); 13 | Task DisplayActionSheet(string title, string cancel, string destruction, params string[] buttons); 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /CustomFormElements/ModalHostPage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Xamarin.Forms; 4 | using System.Threading.Tasks; 5 | 6 | namespace TransparentModal.CustomFormElements 7 | { 8 | public class ModalHostPage : ContentPage, IModalHost 9 | { 10 | #region IModalHost implementation 11 | 12 | public Task DisplayPageModal(Page page) 13 | { 14 | var displayEvent = DisplayPageModalRequested; 15 | 16 | Task completion = null; 17 | if (displayEvent != null) 18 | { 19 | var eventArgs = new DisplayPageModalRequestedEventArgs(page); 20 | displayEvent(this, eventArgs); 21 | completion = eventArgs.DisplayingPageTask; 22 | } 23 | 24 | // If there is not task, just create a new completed one 25 | return completion ?? Task.FromResult(null); 26 | } 27 | // 28 | // public Task IModalHost.DisplayAlert(string title, string message, string cancel) => base.DisplayAlert(title, message, cancel); 29 | // public Task IModalHost.DisplayAlert(string title, string message, string accept, string cancel) => base.DisplayAlert(title, message, accept, cancel); 30 | // public Task IModalHost.DisplayActionSheet(string title, string cancel, string destruction, params string[] buttons) => base.DisplayActionSheet(title, cancel, destruction, buttons); 31 | // 32 | #endregion 33 | 34 | public event EventHandler DisplayPageModalRequested; 35 | 36 | public sealed class DisplayPageModalRequestedEventArgs : EventArgs 37 | { 38 | public Task DisplayingPageTask { get; set;} 39 | 40 | public Page PageToDisplay { get; } 41 | 42 | public DisplayPageModalRequestedEventArgs(Page modalPage) 43 | { 44 | PageToDisplay = modalPage; 45 | } 46 | } 47 | } 48 | } 49 | 50 | 51 | -------------------------------------------------------------------------------- /CustomFormElements/ModalPage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using Xamarin.Forms; 4 | 5 | namespace TransparentModal.CustomFormElements 6 | { 7 | public class ModalPage : ContentPage 8 | { 9 | public Task Close() 10 | { 11 | var displayEvent = CloseModalRequested; 12 | 13 | Task completion = null; 14 | if (displayEvent != null) 15 | { 16 | var eventArgs = new CloseModalRequestedEventArgs(); 17 | displayEvent(this, eventArgs); 18 | completion = eventArgs.ClosingPageTask; 19 | } 20 | 21 | // If there is no task, just create a new completed one 22 | return completion ?? Task.FromResult(null); 23 | } 24 | 25 | public event EventHandler CloseModalRequested; 26 | 27 | public sealed class CloseModalRequestedEventArgs : EventArgs 28 | { 29 | public Task ClosingPageTask { get; set; } 30 | } 31 | } 32 | } 33 | 34 | -------------------------------------------------------------------------------- /Pages/FirstPage.xaml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |