Coder Social home page Coder Social logo

dioscarr / xamarin.forms.pancakeview Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sthewissen/xamarin.forms.pancakeview

0.0 0.0 0.0 8.36 MB

An extended ContentView for Xamarin.Forms with rounded corners, borders, shadows and more!

License: MIT License

C# 100.00%

xamarin.forms.pancakeview's Introduction

Xamarin.Forms.PancakeView

An extended ContentView for Xamarin.Forms with rounded corners, borders, shadows and more!

Build status

Why PancakeView?

In a lot of Xamarin.Forms UI work I do I have the need for a layout/view that I can use that supports gradients, borders, rounded corners and shadows. Since none of the existing Xamarin.Forms controls fit the bill I decided to roll my own. And why is it called a PancakeView you ask? Well, pancakes are also round, have shadows and have a glorious gradient color. What better fit can you think of?

How to use it?

The project is up on NuGet at the following URL:

https://www.nuget.org/packages/Xamarin.Forms.PancakeView

You could also simply clone the repository and include the projects in the src folder in your Xamarin.Forms and Platform projects. It uses multi-targeting to resolve to the correct platform.

The first thing we need to do is tell our XAML page where it can find the PancakeView, which is done by adding the following attribute to our ContentPage:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"  xmlns:yummy="clr-namespace:Xamarin.Forms.PancakeView;assembly=Xamarin.Forms.PancakeView">
   ...
</ContentPage>

Next up, just smack a PancakeView onto that page and you're all set, simple as baking real pancakes!

<yummy:PancakeView BackgroundColor="#bc91d7" CornerRadius="60,0,0,60" IsClippedToBounds="true" HorizontalOptions="FillAndExpand" HeightRequest="150">
   <Image Source="unicorn.png" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" Aspect="AspectFill" />
</yummy:PancakeView>

What can I do with it?

Property What it does Extra info
BackgroundGradientAngle A value between 0-360 to define the angle of the background gradient.
BackgroundGradientStartColor The start color of the background gradient. A Color object.
BackgroundGradientEndColor The end color of the background gradient. A Color object.
BackgroundGradientStops A list of GradientStop objects that define a multi color gradient. Offset is a value between 0-1 defining the location within the gradient.
BorderDrawingStyle Whether to draw the border on the inside or outside of the control.
BorderColor The color of the border. A Color object.
BorderGradientAngle A value between 0-360 to define the angle of the border gradient.
BorderGradientStartColor The start color of the border gradient. A Color object.
BorderGradientEndColor The end color of the border gradient. A Color object.
BorderGradientStops A list of GradientStop objects that define a multi color gradient. Offset is a value between 0-1 defining the location within the gradient.
BorderIsDashed Whether or not the border needs to be dashed. The length of the dash and spacing between them is currently not editable.
BorderThickness The thickness of the border.
CornerRadius A CornerRadius object representing each individual corner's radius. Uses the CornerRadius struct allowing you to specify individual corners. This does have some drawbacks.
HasShadow Whether or not to draw a shadow beneath the control. For this to work we need to clip the view. This means that individual corner radii will be lost. In this case the TopLeft value will be used for all corners.
Elevation The Material Design elevation desired. For this to work we need to clip the view. This means that individual corner radii will be lost. In this case the TopLeft value will be used for all corners.

Example

xamarin.forms.pancakeview's People

Contributors

sthewissen avatar roubachof avatar miiite avatar feliperugai 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.