• Stars
    star
    414
  • Rank 104,550 (Top 3 %)
  • Language
    C#
  • License
    MIT License
  • Created over 5 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The package you didn't even know you needed!

Xamarin.Forms.DebugRainbows

The package you didn't even know you needed!

Build status NuGet

Why DebugRainbows?

Have you ever had a piece of XAML code that didn't produce the layout you expected? Did you change background colors on certain elements to get an idea of where they are positioned? Admit it, you have and pretty much all of us have at some point. Either way, this is the package for you! It adds some nice colorful debug modes to your ContentPages or specific visual elements that lets you immediately see where all of your elements are located!

API Reference

Property What it does
GridLineColor Defines a color for the grid lines or blocks (depending on Inverse).
GridLineOpacity The opacity of the grid lines in the overlay.
GridLineWidth The width of the grid lines or between each block (depending on Inverse).
GridOrigin Where the first line is drawn. Either TopLeft or Center.
GridPadding Pads the entire overlay. Takes a Thickness object.
HorizontalSpacing Width between grid lines or the width of the blocks (depending on Inverse).
Inverse Either draws grid lines (false) or block view (true).
MajorGridLineColor When using major grid lines you can color them differently.
MajorGridLineInterval Defines the interval of when a major grid line should be drawn.
MajorGridLineOpacity The opacity of the major grid lines in the overlay.
MajorGridLineWidth The width of the major grid lines or space between block (depending on Inverse).
MakeGridRainbows Throws some instant joy into your overlays.
ShowColors Automatically gives every visual element a random background color.
ShowGrid Draws a customizable grid overlay used to help you align elements.
VerticalItemSize Height between grid lines or the height of the blocks (depending on Inverse).

How to use it?

The project is up on NuGet at the following URL:

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

Install this package into your shared project and your platform specific projects. After that you're good to go! Simply add the namespace declaration and set the ShowColors or ShowGrid attached property to true!

XAML UI

Apply to an individual Xamarin.Forms.ContentPage

<ContentPage rainbows:DebugRainbow.ShowColors="true"
   xmlns="http://xamarin.com/schemas/2014/forms" 
   xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
   xmlns:rainbows="clr-namespace:Xamarin.Forms.DebugRainbows;assembly=Xamarin.Forms.DebugRainbows" 
   x:Class="MyNamespace.MainPage">
             
  ...
             
</ContentPage>

Apply to every Xamarin.Forms.ContentPage

In App.xaml, we can add a Style to our ResourceDictionary:

<?xml version="1.0" encoding="utf-8"?>
<Application xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             x:Class="MyNamespace.App"
             xmlns:rainbows="clr-namespace:Xamarin.Forms.DebugRainbows;assembly=Xamarin.Forms.DebugRainbows" >
    <Application.Resources>
        <ResourceDictionary>
            <Style TargetType="ContentPage" ApplyToDerivedTypes="True">
               <Setter Property="rainbows:DebugRainbow.ShowColors" Value="True" />
            </Style>
        </ResourceDictionary>
    </Application.Resources>
</Application>

Coded UI

Apply to an individual Xamarin.Forms.ContentPage

public MyContentPage : ContentPage
{
    Xamarin.Forms.DebugRainbows.DebugRainbow.SetShowColors(this, true);
}

Apply to every Xamarin.Forms.ContentPage

public class App : Xamarin.Forms.Application
{
    public App()
    {
    
#if DEBUG
        EnableDebugRainbows(true);
#endif
        
        //...
    });
    
    void EnableDebugRainbows(bool shouldUseDebugRainbows)
    {
        Resources.Add(new Style(typeof(ContentPage))
        {
            ApplyToDerivedTypes = true,
            Setters = {
                new Setter
                {
                    Property = Xamarin.Forms.DebugRainbows.DebugRainbow.ShowColorsProperty,
                    Value = shouldUseDebugRainbows
                }
            }
        });
    }
 }

More Repositories

1

Xamarin.Forms.PancakeView

An extended ContentView for Xamarin.Forms with rounded corners, borders, shadows and more!
C#
862
star
2

Xamarin.Forms.StateSquid

Spiritual successor to EasyLoading, turn any layout element into an individual state-aware element.
C#
249
star
3

KickassUI.Spotify

A Xamarin.Forms version of the Spotify app to prove you can create goodlooking UI with Xamarin.Forms
C#
240
star
4

Mynt

An Azure Functions-based crypto currency trading bot; featuring 10 exchanges, 25 indicators, custom strategy support, backtester and more
C#
236
star
5

Xamarin.Forms.EasyLoading

Loading views made easy!
C#
121
star
6

KickassUI.ParallaxCarousel

A Xamarin.Forms version of a parallax carousel to prove you can create goodlooking UI with Xamarin.Forms
C#
115
star
7

MVP

Unofficial app to help MVPs manage their community activities
C#
111
star
8

KickassUI.Runkeeper

A Xamarin.Forms version of the Runkeeper app to prove you can create goodlooking UI with Xamarin.Forms
C#
105
star
9

KickassUI.Twitter

A Xamarin.Forms version of the Twitter app to prove you can create goodlooking UI with Xamarin.Forms
C#
87
star
10

iBakePancakes

A fancy UI sample for an app providing pancake recipes
C#
77
star
11

KickassUI.Chameleon

A Xamarin.Forms based encyclopedia UI example
C#
72
star
12

Plugin.Maui.DebugRainbows

C#
72
star
13

KickassUI.Banking

A Xamarin.Forms version of a banking app concept, showing off how to use a base page
C#
64
star
14

KickassUI.Traveler

A Xamarin.Forms based travel app UI sample
C#
59
star
15

Coffeeffee

Implementation of a coffee shopping UI using Xamarin.Forms
C#
52
star
16

FocusOnXamarin

NET Conf: Focus on Xamarin sample
C#
51
star
17

KickassUI.FancyTutorial

A simple Xamarin.Forms tutorial screen
C#
48
star
18

KickassUI.InSpace

C#
43
star
19

MSALSample

A quick sample on how to implement MSAL in your app.
C#
19
star
20

YouTubeEmbed

Sample on how you can embed YouTube content in your Xamarin Forms app.
C#
15
star
21

Xamarin.Neumorphism

C#
13
star
22

SkiaGitHubGraph

A GitHub-type contribution graph using SkiaSharp
C#
12
star
23

AnimationsSample

A few animation samples using Xamarin.Forms
C#
9
star
24

PancAPI

A simple json file with pancake data :D
6
star
25

BasePageRevisited

C#
3
star
26

PropPlaques

A bunch of STL files that can be used to print small plaques for geeky/nerdy props
2
star
27

thewissenio

Personal website, yay!
SCSS
1
star
28

presentations

1
star