Skip to content

Instantly share code, notes, and snippets.

@smetlov
smetlov / C#
Created December 1, 2016 09:04
true & null // Null
false & null // False
true | null // True
false | null // Null
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="AppTheme" parent="AppTheme.Base">
</style>
<style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primaryDark</item>
<item name="colorAccent">@color/accent</item>
<item name="windowActionModeOverlay">true</item>
</style>
[assembly: ExportRenderer(typeof(MainPage), typeof(MainPageRenderer))]
namespace CustomBottomMenu.Droid.Renderers
{
internal class MainPageRenderer : VisualElementRenderer<MainPage>, IOnTabClickListener
{
public MainPageRenderer()
{
// Required to say packager to not to add child pages automatically
AutoPackage = false;
<?xml version="1.0" encoding="utf-8" ?>
<pages:BaseContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:pages="clr-namespace:CustomBottomMenu.Pages;assembly=CustomBottomMenu"
x:Class="CustomBottomMenu.Pages.AboutPage"
Title="About">
<Label Text="About" VerticalOptions="Center" HorizontalOptions="Center" />
</pages:BaseContentPage>
public partial class MainPage
{
public MainPage()
{
InitializeComponent();
}
protected override void OnCurrentPageChanged()
{
base.OnCurrentPageChanged();
<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:pages="clr-namespace:CustomBottomMenu.Pages;assembly=CustomBottomMenu"
x:Class="CustomBottomMenu.Pages.MainPage">
<pages:AboutPage Icon="ic_about" />
<pages:ContactsPage Icon="ic_contact" />
</TabbedPage>
public abstract class BaseContentPage : ContentPage
{
public void SendAppearing()
{
OnAppearing();
}
public void SendDisappearing()
{
OnDisappearing();
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
namespace CustomBottomMenu.Droid
{
[Activity(Label = "CustomBottomMenu", Icon = "@drawable/icon", MainLauncher = true,
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation,
Theme = "@style/AppTheme")]
public class MainActivity : FormsAppCompatActivity
{
protected override void OnCreate(Bundle bundle)
{
ToolbarResource = Resource.Layout.toolbar;