Posts

Showing posts from 2020

Xamarin Forms : How to Show PopUp Page In Xamarin Forms

Image
   How to Show PopUp Page In Xamarin Forms  Step 1 We need Third Page Plugin to achieve same. Go to Manage Nuget Packages - > Search for Rg.Plugins.Popup Once Installed in Project We need to configure same in Android and IOS Projects  In Android   - Go to MainActivity.cs Code:    Rg.Plugins.Popup. Popup .Init( this , savedInstanceState); In IOS –  Go to  - AppDelegate.cs Code : Rg.Plugins.Popup. Popup .Init(); Now Back to Main Project (PCL) Step – 1   Add Page in Project Once Added Page Change the Tag of Page Default Page  : Need to Replace ContentPage with Pages:PopupPage < ContentPage  xmlns ="http://xamarin.com/schemas/2014/forms" Change To < pages : PopupPage  xmlns ="http://xamarin.com/schemas/2014/forms" Step – 2 Add Class Reference to Page Code xmlns : animations ="clr-namespace:Rg.Plugins.Popup.Animations;assembly=Rg.Plugins.Popup" xmlns : pages ="clr-namespace:Rg.Plugins.Popup.Pages;a...

Xamarin Forms : Find Control of MainPage from any Class or Page

Image
  Xamarin Forms : Find Control of MainPage from any Class or Page E.g. If you have Menu on MainPage and you need to apply Rights from User Validation Class. How do you access Control / Button of Menu from the class Add caption Code : Button  button =  null ; button = ( Button ) App .Current.MainPage.FindByName( "btnStkRpt_CustCsgSumm" ); if  (button !=  null ) {   button.IsEnabled =  true ;   button.IsVisible =  true ; }   Note : This will find control on mainpage (Startup Page or Current Main Page)      

Xamarin Forms - Icon/Image in Toolbar of Navigation Page

Image
Icon/Image in Toolbar of Navigation Page  Code : Page XAML < ContentPage.ToolbarItems >          < ToolbarItem  Name = "imgrcLogo"  Icon = "RCLogo.png"  Priority = "0"  Order = "Primary"  />          < ToolbarItem    x : Name = "userInfo"    Priority = "0"  Order = "Primary"     />      </ ContentPage.ToolbarItems > Logo file is Places in Resouce Directory of Andriod project

Xamarin Forms - Close the Application in Andriod and IOS

Close the Application in Andriod and IOS if (Device.RuntimePlatform == Device.iOS) {        Thread.CurrentThread.Abort();  } else if (Device.RuntimePlatform == Device.Android) {     Android.OS.Process.KillProcess(Android.OS.Process.MyPid()); }

Xamarin Forms - Change Colour of Navigation Bar (Page Title For Master-Detail Template)

Image
Change All Toolbar Bar Color (Toolbar is Actually Navigation Page) Navigation Page Title Colour can be Changed using Style Type in App.XAML Navigation Page Appears in case of Master-Details Template Type We need to create Global Style Type in APP.xaml Code :  <Style TargetType="NavigationPage">                           <Setter Property="BarBackgroundColor" Value="Color.LightGray"/> </Style>

Xamarin Forms : PopUp Page with RG.Plugins.Popup

Image
How to Show PopUp Page In Xamarin Forms Step 1 First, we need to add the Third Page Plugin to achieve the same. [ Rg.Plugins.Popup ] Go to Manage Nuget Packages - > Search for Rg.Plugins.Popup Once the plugin is installed in the Project We need to configure same in Android and IOS Projects In Android   - Go to MainActivity.cs Code:     Rg.Plugins.Popup. Popup .Init( this , savedInstanceState); In IOS –   Go to   - AppDelegate.cs Code : Rg.Plugins.Popup. Popup .Init(); Now Back to Main Project (PCL) Step – 1 :   Add Page in Project Once Added Page Change the Tag of Page Default Page has Content page as Tag which needs to be replaced with PopUpPage Class  :  Default Page:- Class < ContentPage  xmlns ="http://xamarin.com/schemas/2014/forms" Change To < pages : PopupPage  xmlns ="http://xamarin.com/schemas/2014/forms" This is how it should Lo...