Giter Site home page Giter Site logo

com.ptdave.xamarin's Introduction

com.ptdave.xamarin

Simple tools to help improve the speed of development

Initialization

Android

Inside of your main activity, please initialize the plugin in order to use the DependencyService injections like so:

com.ptdave.xamarin.Helper.Initialize(this, savedInstanceState);

iOS

Inside of your AppDelegate, please initialize the plugin in order to use the DependencyService injections like so:

com.ptdave.xamarin.Helper.Initialize();

File Helper

The file helper is intended to prevent having to create your own file location handlers for plugins like SQLite or others.

var fileService = DependencyService.Get<IFileHelper>();
var dbPath = fileService.DatabaseFile("data.db");

Additional paths will become available as necessary

Font Helpers

Simple addons to retrieve all the font unicode values for FontAwesome 5 and Material Icons

Add the following to your xml

xmlns:fonthelper="clr-namespace:com.ptdave.xamarin.FontHelpers;assembly=com.ptdave.xamarin"

Then you can access it easily like so (Your font family may vary):

<Image>
    <Image.Source>
        <FontImageSource
            FontFamily="{StaticResource fa-fab}"
            Glyph="{x:Static fonthelper:FAB.Microsoft}"
            Size="40"
            Color="Black" />
    </Image.Source>
</Image>

Behaviors

Several behaviors are there to simplify some work and validation

  • InputMask - Input masking for entries
  • Minimum Length - Does the input string meet the required length?
  • RegExp Tester - Does the input match the enterred regex?
  • Had Focus - Has the field had focus?

Value Converters

These are some simple converters

  • GreaterThan (Returns true if a value is greater than specified parameter)
  • IsEmpty (Returns if a string or IEnumerable is empty)
  • Invert (false to true, true to false)
  • IsNull (Bound object is null (true/false))
  • IsNotEmpty (Returns if a string or IEnumerable is not empty)
  • IsNotNull (Bound object is not null (true/false))
  • StringLength (Returns the length of the bound string, defaults 0)
  • ToCurrency (Returns double value to Currency i.e. ToString("C"))
  • ToLower (Returns string in lowercase)
  • ToUpper (Returns string to uppercase)

Accessible by adding the following to your ContentPage Xaml:

xmlns:vc="clr-namespace:com.ptdave.xamarin.ValueConverters;assembly=com.ptdave.xamarin"

The following is an example of adding it to the ResourceDictionary for that ContentPage

<ContentPage.Resources>
    <ResourceDictionary>
        <vc:Invert x:Key="Invert" />
        <vc:IsNotNull x:Key="IsNotNull" />
        <vc:IsNull x:Key="IsNull" />
        <vc:StringLength x:Key="StringLength" />
    </ResourceDictionary>
</ContentPage.Resources>

Contributing

I accept pull request. I just ask that you please discuss with me first what you want to accomplish to see if it fits the project.

Acknowledgements

The following people have either helped in the project or allowed their code snippets to be used in the project.

com.ptdave.xamarin's People

Contributors

jtone123 avatar ptdave20 avatar spud-dmarchbanks avatar

Watchers

 avatar

Forkers

handypro jtone123

com.ptdave.xamarin's Issues

MAUI Support?

Hi, Thanks for the great work.

Can you advise me on how can I use this in the Maui application?

Thanks

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.