Coder Social home page Coder Social logo

quiest2000 / xamarincommunitytoolkit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xamarin/xamarincommunitytoolkit

0.0 0.0 0.0 7.32 MB

The Xamarin Community Toolkit is a collection of Animations, Behaviors, Converters, and Effects for mobile development with Xamarin.Forms. It simplifies and demonstrates common developer tasks building iOS, Android, and UWP apps with Xamarin.Forms.

License: MIT License

C# 100.00%

xamarincommunitytoolkit's Introduction

.NET Foundation

Xamarin Community Toolkit

Members of the community are rebooting this library under the guidance of the Xamarin team. The Xamarin Community Toolkit is a collection of common elements for mobile development with Xamarin.Forms that people tend to replicate across multiple apps. It simplifies and demonstrates common developer tasks when building apps with Xamarin.Forms. If you're looking for the historical code to reference, please check the legacy branch.

Build Status

If you like to live dangerously (and while we are preparing our v1), you can use our nightly feed to try out packages right now.

Build Server Type Platform Status
Azure DevOps Build Windows & Mac Build Status

Sample App

Browsing the sample app is the best place to start exploring what's available today.

Installation

The toolkit is available via NuGet, and should be installed into all your projects:

  • NuGet Official Releases: NuGet
  • NuGet Nightly Releases: NuGet Nightly

Now all you need to do is use it!

Documentation

Toast

There are 2 different ways to use Toast.

  1. On your Page call the method:
await MyPage.DisplayToastAsync(message, duration);

where message is your text, and duration is optional parameter. Default duration = 3000;

  1. For advanced settings:
    var messageOptions = new MessageOptions
    {
        Foreground = Color.Black,
        Font = Font.OfSize("Arial", 14),
        Message = "My text"
    };
    var options = new ToastOptions
    {
        MessageOptions = messageOptions,
        Duration = 3000,
        BackgroundColor = Color.Default,
        IsRtl = false,
    };
    await this.DisplayToastAsync(options);

Snackbar

Snackbar has API which is similar to the Toast.

  1. On your Page call the method:
var result = await MyPage.DisplaySnackbarAsync(message, actionButtonText, action, duration);

where message is your text, actionButtonText is the text for the button, action is a Func<Task> and duration is optional parameter. Default duration = 3000;

  1. For advanced settings:
    var messageOptions = new MessageOptions
    {
        Foreground = Color.Black,
        Font = Font.OfSize("Arial", 14),
        Message = "My text"
    };
    var actionOptions = new List<SnackBarActionOptions>
    {
        new SnackBarActionOptions
        {
            ForegroundColor = Color.Black,
            BackgroundColor = Color.White,
            FontFamily = Font.OfSize("Arial", 14),
            Text = "My text",
            Action = () => // null by default
            {
                Debug.WriteLine("1");
                return Task.CompletedTask;
            }
        }
    };
    var options = new SnackbarOptions
    {
        MessageOptions = messageOptions,
        Duration = 3000,
        BackgroundColor = Color.Default,
        IsRtl = false,
        Actions = actionOptions
    };
    var result = await this.DisplayToastAsync(options);

The result is Boolean. True - if snackbar is closed by user. False - if snackbar is closed by timeout.

AvatarView

You first include the toolkit namespace:

xmlns:xct="http://xamarin.com/schemas/2020/toolkit"

Then place the view in your XAML:

<xct:AvatarView Text="DO" Size="46" Color="#FF3300" TextColor="White" />

Of course, AvatarView also supports Source for loading images plus a few other properties. Check it out!

AvatarView

Contributions welcome!

If you have one or more of these common pieces of code that you are always replicating across apps, don't hesitate to contribute! We aim to be the first NuGet package you install when creating a new Xamarin app!

Please have a look at our contribution guide before you get started. Also take note of the Code of Conduct we adhere to.

Community Toolkit Principles

  • Principle #1: The toolkit will be kept simple.
  • Principle #2: As soon as a comparable feature is available in Xamarin.Forms, it will be marked as deprecated.
  • Principle #3: All features will be supported for two Xamarin.Forms release cycles or until another principle supersedes it.

Project Structure

To structure our project, we have adopted a range of namespaces. You can find them below with a short description of what you will find where.

Namespace Description
Xamarin.CommunityToolkit.Core Core objects that do not fit other namespaces and are used by multiple other components
Xamarin.CommunityToolkit.Behaviors Extended behaviors for the Xamarin.Forms components
Xamarin.CommunityToolkit.Converters XAML converters, used to converted your data binding data into something your XAML understands
Xamarin.CommunityToolkit.Effects Effects to apply light-weight renderer changes to the Xamarin.Forms renderers
Xamarin.CommunityToolkit.Extensions XAML Markup Extensions to make your XAML even more functional
Xamarin.CommunityToolkit.ObjectModel Things that have to do with your models and objects. Probably handy for your MVVM needs
Xamarin.CommunityToolkit.UI.Layout Layouts such as WrapLayout, etc.
Xamarin.CommunityToolkit.UI.Views Controls such as TabView, etc.
Xamarin.CommunityToolkit.SampleApp Sample App where you can find all of the above for reference. Learn how to use them and see how it all looks
Xamarin.CommunityToolkit.UnitTests This is where our unit tests live. Please keep growing them!

Code of Conduct

As a part of the .NET Foundation, we have adopted the .NET Foundation Code of Conduct. Please familiarize yourself with that before participating with this repository. Thanks!

.NET Foundation

This project is supported by the .NET Foundation.

xamarincommunitytoolkit's People

Contributors

andreimisiukevich avatar jfversluis avatar github-actions[bot] avatar pictos avatar bartlannoeye avatar jsuarezruiz avatar jamesmontemagno avatar vladislavantonyuk avatar sthewissen avatar bmacombe avatar jbijsterboschnl avatar davidortinau avatar lachlanwgordon avatar acuntex avatar char0394 avatar seuleuzeuh avatar almirvuk avatar mattleibow avatar cfun1 avatar ieuanwalker avatar pauldipietro avatar axemasta avatar dansiegel avatar hackavist avatar peterfoot avatar vincenth-net avatar adenearnshaw avatar aswinpg avatar nostah avatar berhir 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.