Billy Chandler

Billy Chandler

1620178468

Lifecycle Events (Xamarin Community Toolkit)

Pedro is back for another episode! This time he will tell us all about the Lifecycle Effect that he implemented for the Xamarin Community Toolkit. With this effect you can hook into the Loaded and Unloaded event of any VisualElement and even pages.

Tune in to this episode and learn all about it.

Useful Links:

#xamarin #developer

What is GEEK

Buddha Community

Lifecycle Events (Xamarin Community Toolkit)
Cayla  Erdman

Cayla Erdman

1602318660

Join Hacktoberfest at the Xamarin Community Toolkit

You may have heard about the Xamarin Community Toolkit by now. This toolkit will be an important part of the Xamarin.Forms ecosystem during the evolution to .NET 6. Now is the time to contribute since it is “Hacktoberfest” after all!

What is the Xamarin Community Toolkit?

Since Xamarin.Forms 5 will be the last major version of Forms before .NET 6, we wanted to have an intermediate library that can still add value for Forms in the meanwhile. However, why stop there? There is also a lot of converters, behaviors, effects, etc. that everyone is continually rewriting. To help avoid this, we consolidated all of those into the Xamarin Community Toolkit.

This toolkit already has a lot of traction and support from our wonderful community, but there is always room for more! Lucky for us, that time of year which makes contributing extra special is upon us again.

Hacktoberfest 2020

For Hacktoberfest we welcome you all to join us and plant that tree (new reward by Hacktoberfest!) or earn that t-shirt while giving some of your valuable time to our library. On top of that, we will offer some swag whenever you decide to contribute. When you do, we will reach out to you near the end of October and if your PRs are eligible to make sure we get your details. That means: no need to do anything special, just crush that code!

HacktoberFest Xamarin Community Toolkit Flyer

#announcements #events #xamarin #xamarin.forms #hacktoberfest #xamarin community toolkit

Gaurav Singh

1609755091

Xamarin Forms Training Institute | Xamarin Forms Development Classes | Xamarin Training

In this Xamarin Online course, you will learn each and every topic with the help of hands-on labs. This program includes a hands-on live project with the implementation of recommended design patterns and practices. The learning path for this program is given below:
Xamarin Training objective
At the completion of this course, attendees will be able to;

  1. Understand Xamarin architecture
  2. Understand Xamarin .Android, Xamarin. iOS fundamentals
  3. Understand Xamarin. Forms fundamentals
  4. Build UI with XAML and code
  5. Work with images, display data beautifully and create interactive lists
  6. Implement multi-page apps with navigation, tabs, master/detail pages
  7. Store and retrieve data from a variety of sources like file system, SQLite database and RESTful services
  8. Implement MVVM pattern

#xamarin training #xamarin course #xamarin forms course #xamarin online course #xamarin forms training #xamarin training course

How to Design Login Page using Xamarin Forms C# | Login Form | Sign In UI Design

#xamarin
#aspdotnetexplorer
https://www.youtube.com/watch?v=2tehSdX897E

#xamarin forms #xamarin forms bangla tutorials for beginners #xamarin forms tutorials for beginners #xamarin #xamarin.forms #xamarin.forms ui

the featured effects available in Xamarin Community Toolkit

In this post, we are going to see the featured effects available in Xamarin Community Toolkit and how to use them. This post is a part of Xamarin Community Toolkit - Tutorial Series, visit the post to know about the Xamarin Community Toolkit. The Xamarin Community Toolkit is a collection of reusable elements for mobile development with Xamarin.Forms, including animations, behaviors, converters, effects, and helpers. It simplifies and demonstrates common developer tasks when building iOS, Android, macOS, WPF, and Universal Windows Platform (UWP) apps using Xamarin.Forms. 

Coding Part

Steps

  1. Step 1: Creating new Xamarin.Forms Projects.
  2. Step 2: Setting up the Xamarin Community Toolkit in Xamarin.Forms .Net Standard Project.
  3. Step 3: Implementation of Effects using Xamarin Community Toolkit.

Step 1: Creating new Xamarin.Forms Projects

Create New Project by Selecting New Project à Select Xamarin Cross Platform App and Click OK.

Note: Xamarin.Forms version should be greater than 5.0.

Then Select Android and iOS Platforms as shown below with Code Sharing Strategy as PCL or .Net Standard and Click OK.

Step 2: Setting up the scanner in Xamarin.Forms .Net Standard Project

In this step, we will see how to setup the plugin.

  • Open the Nuget Manager in the Visual Studio Solution by right clicking the solution and select “Manage Nuget Packages”.
     

  • Then select “Xamarin Community Toolkit” and check all the projects in the solution, install the plugin

    ​​​​​

Step 3: Implementation of Effects using Xamarin Community Toolkit.

In this step, we will see how to implement the featured effects offered in Xamarin Community Toolkit. Here, we have explained the implementation of Safe Area Effect, Shadow Effect, Life Cycle Effect, and StatusBar Effect.

  • Open your XAML design file and add the following namespace to utilize the views on the screen.
xmlns:xct="http://xamarin.com/schemas/2020/toolkit"

C#

SafeAreaEffect

  • The SafeAreaEffect is an effect that can be added to any element through an attached property to indicate whether or not that element should take current safe areas into account.
  • This is an area of the screen that is safe for all devices that use iOS 11 and greater.

Specifically, it will help to make sure that content isn't clipped by rounded device corners, the home indicator, or the sensor housing on an iPhone X. The effect only targets iOS, meaning that on other platforms it does not do anything.

Properties

<StackLayout xct:SafeAreaEffect.SafeArea="True" BackgroundColor="White"> </StackLayout>

C#

SafeArea

Indicates which safe areas should be taken into account for this element

Before Applying the Effect

After Applying the Effect

ShadowEffect

It is used to have a shadow effect for Xamarin Forms Views and we have five properties that need to be understood to use this effect.

Properties

  1. Color: It's the color that the shadow will have.
  2. Opacity: With this property, you can control the opacity you want in the shadow.
  3. Radius: It’s responsible for handling the blurring in the shadow.
  4. OffsetX/OffsetY: It allows us to define the displacement that the shadow will have, therefore OffsetX is responsible for specifying the distance of the horizontal displacement, while OffsetY of the vertical displacement.

In this example, I have updated the shadow effect for the Image Control like in the following code block

<Image
	x:Name="img"
	HeightRequest="150"
	Margin="10"
	xct:ShadowEffect.Color="Green"
	xct:ShadowEffect.OffsetY="15"
	Source="https://shorturl.at/qsvJ1">
</Image>

C#

Lifecycle Effect

The LifecycleEffect allows you to determine when a VisualElement has its renderer allocated by the platform. It can be identified by using the LifeCycleEffect event handlers.

<Image
	x:Name="img"
	HeightRequest="150"
	Margin="10"
	Source="https://shorturl.at/qsvJ1">
	<Image.Effects>
		<xct:LifecycleEffect Loaded="LifeCycleEffect_Loaded" Unloaded="LifeCycleEffect_Unloaded" />
	</Image.Effects>
</Image>

C#

private void LifeCycleEffect_Loaded(object sender, EventArgs e)
{
	Console.WriteLine("Image loaded...");
}

private void LifeCycleEffect_Unloaded(object sender, EventArgs e)
{
	Console.WriteLine("Image Unloaded...");
}

C#

Statusbar Effect

  • This effect is used to control the status bar color in the Xamarin Forms Application during the compile time or runtime or like button clicks. It is a single line code to be useful to control.

In this example, we will create color resource in the App.xaml file like below. It will be updated later dynamically.

<Color x:Key="StatusBarColor">Firebrick</Color>

C#

Then add the following line in the root element of your XAML page as a DynamicResource

xct:StatusBarEffect.Color="{DynamicResource StatusBarColor}"

C#

Then add the 3 buttons like in the sample screen and update your dynamic resource color on button click like below.

private void ButtonClicked(object sender, EventArgs e)
{
	Application.Current.Resources["StatusBarColor"] = ((Button)sender).TextColor;
}

C#

Full Code

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:xct="http://xamarin.com/schemas/2020/toolkit"
             x:Class="XamarinCommunityToolkit.EffectsSamplePage"
             xct:StatusBarEffect.Color="{DynamicResource StatusBarColor}">
    <ContentPage.Content>
        <StackLayout xct:SafeAreaEffect.SafeArea="True"
                     BackgroundColor="White">

            <Frame BackgroundColor="#2196F3"
                   Padding="24"
                   CornerRadius="0">
                <Label Text="Xamarin Forms Effects using XCT"
                       HorizontalTextAlignment="Center"
                       TextColor="White"
                       FontSize="36"/>
            </Frame>

            <Image
                x:Name="img"
                HeightRequest="150"
                Margin="10"
                xct:ShadowEffect.Color="Green"
                xct:ShadowEffect.OffsetY="15"
                Source="https://shorturl.at/qsvJ1">
                <Image.Effects>
                    <xct:LifecycleEffect Loaded="LifeCycleEffect_Loaded" Unloaded="LifeCycleEffect_Unloaded" />
                </Image.Effects>
            </Image>
            <Grid Padding="10">
                <Button Clicked="ButtonClicked" Text="Red" TextColor="Red" BorderColor="Red" BorderWidth="2" Grid.Column="0"/>
                <Button Clicked="ButtonClicked" Text="Green" TextColor="Green" BorderColor="Green" BorderWidth="2" Grid.Column="1"/>
                <Button Clicked="ButtonClicked" Text="Blue" TextColor="Blue" BorderColor="Blue" BorderWidth="2" Grid.Column="2"/>
            </Grid>
        </StackLayout>
    </ContentPage.Content>
</ContentPage>

C#

The XCT offering other type effects as well and please visit the below link for more samples. https://github.com/xamarin/XamarinCommunityToolkit/tree/main/samples/XCT.Sample/Pages/Effects

Download Code

You can download the code from GitHub. If you have doubt, feel free to post comment. If you like this article and is useful to you, do like, share the article & star the repository on GitHub.

 Source: https://www.c-sharpcorner.com/article/xamarin-community-toolkit-effects/

#xamarin #community #toolkit #effective 

Los Efectos Destacados Disponibles En Xamarin Community Toolkit

En esta publicación, veremos los efectos destacados disponibles en Xamarin Community Toolkit y cómo usarlos. Esta publicación es parte de Xamarin Community Toolkit - Tutorial Series , visite la publicación para obtener información sobre Xamarin Community Toolkit. El kit de herramientas de la comunidad de Xamarin es una colección de elementos reutilizables para el desarrollo móvil con Xamarin.Forms, que incluye animaciones, comportamientos, convertidores, efectos y ayudantes. Simplifica y demuestra las tareas comunes de los desarrolladores al crear aplicaciones para iOS, Android, macOS, WPF y Universal Windows Platform (UWP) con Xamarin.Forms. 

Parte de codificación

Pasos

  1. Paso 1: creación de nuevos proyectos de Xamarin.Forms.
  2. Paso 2: configurar el kit de herramientas de la comunidad de Xamarin en Xamarin.Forms .Net Standard Project.
  3. Paso 3: Implementación de efectos usando Xamarin Community Toolkit.

Paso 1: creación de nuevos proyectos de Xamarin.Forms

Cree un nuevo proyecto seleccionando Nuevo proyecto à Seleccione Xamarin Cross Platform App y haga clic en Aceptar.

Nota: la versión de Xamarin.Forms debe ser superior a 5.0.

Luego, seleccione las plataformas Android e iOS como se muestra a continuación con la estrategia de uso compartido de código como PCL o .Net Standard y haga clic en Aceptar.

Paso 2: Configuración del escáner en Xamarin.Forms .Net Standard Project

En este paso, veremos cómo configurar el complemento.

  • Abra Nuget Manager en Visual Studio Solution haciendo clic derecho en la solución y seleccione "Administrar paquetes Nuget".
     

  • Luego seleccione "Xamarin Community Toolkit" y verifique todos los proyectos en la solución, instale el

    complemento

Paso 3: Implementación de efectos usando Xamarin Community Toolkit.

En este paso, veremos cómo implementar los efectos destacados que se ofrecen en Xamarin Community Toolkit. Aquí, hemos explicado la implementación de Safe Area Effect, Shadow Effect, Life Cycle Effect y StatusBar Effect.

  • Abra su archivo de diseño XAML y agregue el siguiente espacio de nombres para utilizar las vistas en la pantalla.
xmlns:xct="http://xamarin.com/schemas/2020/toolkit"

C#

efecto de área segura

  • SafeAreaEffect es un efecto que se puede agregar a cualquier elemento a través de una propiedad adjunta para indicar si ese elemento debe tener en cuenta las áreas seguras actuales o no.
  • Esta es un área de la pantalla que es segura para todos los dispositivos que usan iOS 11 y superior.

Específicamente, ayudará a asegurarse de que las esquinas redondeadas del dispositivo, el indicador de inicio o la carcasa del sensor en un iPhone X no recorten el contenido. El efecto solo se dirige a iOS, lo que significa que en otras plataformas no hace nada.

Propiedades

<StackLayout xct:SafeAreaEffect.SafeArea="True" BackgroundColor="White"> </StackLayout>

C#

Area segura

Indica qué áreas seguras se deben tener en cuenta para este elemento

Antes de aplicar el efecto

Después de aplicar el efecto

efecto de sombra

Se usa para tener un efecto de sombra para las vistas de Xamarin Forms y tenemos cinco propiedades que deben entenderse para usar este efecto.

Propiedades

  1. Color: Es el color que tendrá la sombra.
  2. Opacidad: Con esta propiedad puedes controlar la opacidad que quieres en la sombra.
  3. Radio: Es responsable de manejar el desenfoque en la sombra.
  4. OffsetX/OffsetY: Nos permite definir el desplazamiento que tendrá la sombra, por lo tanto OffsetX se encarga de especificar la distancia del desplazamiento horizontal, mientras que OffsetY del desplazamiento vertical.

En este ejemplo, actualicé el efecto de sombra para el control de imagen como en el siguiente bloque de código

<Image
	x:Name="img"
	HeightRequest="150"
	Margin="10"
	xct:ShadowEffect.Color="Green"
	xct:ShadowEffect.OffsetY="15"
	Source="https://shorturl.at/qsvJ1">
</Image>

C#

Efecto del ciclo de vida

LifecycleEffect le permite determinar cuándo la plataforma asigna su renderizador a VisualElement. Se puede identificar mediante los controladores de eventos LifeCycleEffect.

<Image
	x:Name="img"
	HeightRequest="150"
	Margin="10"
	Source="https://shorturl.at/qsvJ1">
	<Image.Effects>
		<xct:LifecycleEffect Loaded="LifeCycleEffect_Loaded" Unloaded="LifeCycleEffect_Unloaded" />
	</Image.Effects>
</Image>

C#

private void LifeCycleEffect_Loaded(object sender, EventArgs e)
{
	Console.WriteLine("Image loaded...");
}

private void LifeCycleEffect_Unloaded(object sender, EventArgs e)
{
	Console.WriteLine("Image Unloaded...");
}

C#

Efecto de la barra de estado

  • Este efecto se usa para controlar el color de la barra de estado en la aplicación Xamarin Forms durante el tiempo de compilación o el tiempo de ejecución o los clics de botones similares. Es un código de una sola línea para ser útil para controlar.

En este ejemplo, crearemos un recurso de color en el archivo App.xaml como se muestra a continuación. Se actualizará más adelante de forma dinámica.

<Color x:Key="StatusBarColor">Firebrick</Color>

C#

Luego agregue la siguiente línea en el elemento raíz de su página XAML como DynamicResource

xct:StatusBarEffect.Color="{DynamicResource StatusBarColor}"

C#

Luego agregue los 3 botones como en la pantalla de muestra y actualice el color de su recurso dinámico al hacer clic en el botón como se muestra a continuación.

private void ButtonClicked(object sender, EventArgs e)
{
	Application.Current.Resources["StatusBarColor"] = ((Button)sender).TextColor;
}

C#

Código completo

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:xct="http://xamarin.com/schemas/2020/toolkit"
             x:Class="XamarinCommunityToolkit.EffectsSamplePage"
             xct:StatusBarEffect.Color="{DynamicResource StatusBarColor}">
    <ContentPage.Content>
        <StackLayout xct:SafeAreaEffect.SafeArea="True"
                     BackgroundColor="White">

            <Frame BackgroundColor="#2196F3"
                   Padding="24"
                   CornerRadius="0">
                <Label Text="Xamarin Forms Effects using XCT"
                       HorizontalTextAlignment="Center"
                       TextColor="White"
                       FontSize="36"/>
            </Frame>

            <Image
                x:Name="img"
                HeightRequest="150"
                Margin="10"
                xct:ShadowEffect.Color="Green"
                xct:ShadowEffect.OffsetY="15"
                Source="https://shorturl.at/qsvJ1">
                <Image.Effects>
                    <xct:LifecycleEffect Loaded="LifeCycleEffect_Loaded" Unloaded="LifeCycleEffect_Unloaded" />
                </Image.Effects>
            </Image>
            <Grid Padding="10">
                <Button Clicked="ButtonClicked" Text="Red" TextColor="Red" BorderColor="Red" BorderWidth="2" Grid.Column="0"/>
                <Button Clicked="ButtonClicked" Text="Green" TextColor="Green" BorderColor="Green" BorderWidth="2" Grid.Column="1"/>
                <Button Clicked="ButtonClicked" Text="Blue" TextColor="Blue" BorderColor="Blue" BorderWidth="2" Grid.Column="2"/>
            </Grid>
        </StackLayout>
    </ContentPage.Content>
</ContentPage>

C#

El XCT también ofrece otros tipos de efectos. Visite el siguiente enlace para obtener más ejemplos. https://github.com/xamarin/XamarinCommunityToolkit/tree/main/samples/XCT.Sample/Pages/Effects

Descargar Código

Puedes descargar el código desde GitHub. Si tienes dudas, no dudes en publicar un comentario. Si te gusta este artículo y te resulta útil, haz clic en Me gusta, comparte el artículo y destaca el repositorio en GitHub.

 Fuente: https://www.c-sharpcorner.com/article/xamarin-community-toolkit-effects/

#xamarin #community #toolkit #effective