Giter Club home page Giter Club logo

xamarinformsbasics's Introduction

#Xamarin.Forms Basics This Repository aims to cover most of Xamarin.Forms basic features and some tips that will help you avoid some common problems

###Navigation

  1. Hierarchal Navigation

Pushing the Next Page

Navigation.PushAsync(**YOURPAGECLASS**);

Popping back to previous page

Navigation.PopAsync(**YourPAGeClass**);

Custom Renderers

######Basic Custom Renderer Layout (Ex. Creating a Custom Entry for the iOS platform)

using Xamarin.Forms.Platform.iOS;

[assembly: ExportRenderer (typeof(MyEntry), typeof(MyEntryRenderer))]
namespace CustomRenderer.iOS
{
    public class MyEntryRenderer : EntryRenderer
    {
        protected override void OnElementChanged (ElementChangedEventArgs<Entry> e)
        {
            base.OnElementChanged (e);

            if (Control != null) {
                // do whatever you want to the UITextField here!
                Control.BackgroundColor = UIColor.FromRGB (204, 153, 255);
                Control.BorderStyle = UITextBorderStyle.Line;
            }
        }
    }
}

This Custom Renderer renders an entry with a custom background color in iOS.

######Important Properties of a Custom renderer

  1. Control - references native control (this is what you customize)
  2. Element - references Xamarin.Forms control
  3. Here you can access almost any native library from every platform
  4. [assembly: ExportRenderer (typeof(MyEntry), typeof(MyEntryRenderer))] - this line is important for the assembly to pick up this renderer at runtime

xamarinformsbasics's People

Contributors

rvila7 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.