Skip to content

Instantly share code, notes, and snippets.

View bbenetskyy's full-sized avatar
👾
Making Apps with MAUI 😛

Bohdan Benetskyi bbenetskyy

👾
Making Apps with MAUI 😛
View GitHub Profile
@bbenetskyy
bbenetskyy / AppShell-header-v3.xaml
Created November 22, 2019 09:05
App Shell Flayout Header Xaml Gradients v3
<Shell.FlyoutHeaderTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100" />
</Grid.RowDefinitions>
<magicGradients:GradientView VerticalOptions="FillAndExpand" >
<magicGradients:GradientView.GradientSource>
<magicGradients:GradientCollection>
<magicGradients:RadialGradient Center="0.5,0.5" Shape="Circle" Size="ClosestSide">
@bbenetskyy
bbenetskyy / AppShell-header-v4.xaml
Created November 22, 2019 09:16
AppShell Flyout with Magic Gradients & CSS v4
<Shell.FlyoutHeaderTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100" />
</Grid.RowDefinitions>
<magicGradients:GradientView VerticalOptions="FillAndExpand" >
<magicGradients:GradientView.GradientSource>
<magicGradients:CssGradientSource>
<x:String>
@bbenetskyy
bbenetskyy / AppShell-header-v5.xaml
Created November 22, 2019 09:19
AppShell Flyout with Magic Gradients & CSS v5
<Shell.FlyoutHeaderTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100" />
</Grid.RowDefinitions>
<magicGradients:GradientView VerticalOptions="FillAndExpand" >
<magicGradients:GradientView.GradientSource>
<magicGradients:CssGradientSource>
<x:String>
@bbenetskyy
bbenetskyy / AppShell-header-v6.xaml
Created November 22, 2019 09:21
AppShell Flyout with Magic Gradients & CSS v6
<Shell.FlyoutHeaderTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100" />
</Grid.RowDefinitions>
<magicGradients:GradientView VerticalOptions="FillAndExpand" >
<magicGradients:GradientView.GradientSource>
<magicGradients:CssGradientSource>
<x:String>
@bbenetskyy
bbenetskyy / AppShell-header-v7.xaml
Created November 22, 2019 09:24
AppShell Flyout with Magic Gradients & CSS v7
<Shell.FlyoutHeaderTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100" />
</Grid.RowDefinitions>
<magicGradients:GradientView VerticalOptions="FillAndExpand" >
<magicGradients:GradientView.GradientSource>
<magicGradients:CssGradientSource>
<x:String>
@bbenetskyy
bbenetskyy / AppShell-header-v8.xaml
Created November 22, 2019 09:27
AppShell Flyout with Magic Gradients & CSS v8
<Shell.FlyoutHeaderTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100" />
</Grid.RowDefinitions>
<magicGradients:GradientView VerticalOptions="FillAndExpand" >
<magicGradients:GradientView.GradientSource>
<magicGradients:CssGradientSource>
<x:String>
[assembly: StyleProperty("-xf-vertical-text-alignment", typeof(Label), nameof(TextAlignmentElement.VerticalTextAlignmentProperty))]
//Definition of VerticalTextAlignmentProperty has type of TextAlignment
static class TextAlignmentElement
{
public static readonly BindableProperty VerticalTextAlignmentProperty =
BindableProperty.Create(nameof(ITextAlignmentElement.VerticalTextAlignment), typeof(TextAlignment), typeof(ITextAlignmentElement), TextAlignment.Center);
}
//And TextAlignment has assigned TypeConverter to convert css string to enum
[TypeConverter(typeof(TextAlignmentConverter))]
public enum TextAlignment
public static class StyleSheets
{
public static void RegisterStyle(string name, Type targetType, string bindablePropertyName)
{
var stylePropertyInfo = typeof(Xamarin.Forms.Internals.Registrar).GetProperty("StyleProperties",
BindingFlags.Static | BindingFlags.NonPublic);
if (stylePropertyInfo == null)
return;
var styleProperties = stylePropertyInfo.GetValue(null);
@bbenetskyy
bbenetskyy / App.xaml
Created January 8, 2020 15:56
Add Default Styles for Label, Entry, and Editor (GradientedTabbedApp Part 1)
<?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"
xmlns:magicGradients="clr-namespace:MagicGradients;assembly=MagicGradients"
mc:Ignorable="d"
x:Class="GradientedTabbedApp.App">
<Application.Resources>
<Style TargetType="Label">
@bbenetskyy
bbenetskyy / App.xaml
Created January 8, 2020 16:01
Add ControlTemplate with GradientView and ContentPresenter (GradientedTabbedApp Part 2)
<?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"
xmlns:magicGradients="clr-namespace:MagicGradients;assembly=MagicGradients"
mc:Ignorable="d"
x:Class="GradientedTabbedApp.App">
<Application.Resources>
<Style TargetType="Label">