Effects by PureWeen · Pull Request #1574 · dotnet/maui (original) (raw)

PureWeen

Description of Change

Implements #1226

Usage Examples

Using Routing Effects from Xamarin.Forms

Register your routing effect

appBuilder.ConfigureEffects(builder => { builder.Add<FocusRoutingEffect, FocusPlatformEffect>(); });

Just using the Platform Effect

Because of how MAUI works you don't really need the routing effect anymore so you can just ignore all registration and just add a multi targeted platform effect to xaml

public class FocusPlatformEffect : PlatformEffect { public FocusPlatformEffect() : base() { }

#if WINDOWS protected override void OnAttached() { try { (Control as Microsoft.UI.Xaml.Controls.Control).Background = new Microsoft.UI.Xaml.Media.SolidColorBrush(Microsoft.UI.Colors.Cyan); (Control as MauiTextBox).BackgroundFocusBrush = new Microsoft.UI.Xaml.Media.SolidColorBrush(Microsoft.UI.Colors.White); } catch (Exception ex) { Debug.WriteLine("Cannot set property on attached control. Error: ", ex.Message); } } #endif

protected override void OnDetached()
{
}

}

Register effects via assembly scanning

.ConfigureEffects(effects => { effects.AddCompatibilityEffects(Device.GetAssemblies()); })

@Redth

Love that we don't really need the routing effect with MAUI, that makes the effect code so much cleaner.

@PureWeen

@PureWeen

PureWeen

namespace Microsoft.Maui.Controls
{
public partial class Element : Maui.IElement
public partial class Element : Maui.IElement, IEffectControlProvider

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In XF all the renderers implemented IEffectControlProvider so this just consolidates that behavior to the Element instead of the renderer

@PureWeen

@PureWeen PureWeen marked this pull request as ready for review

July 8, 2021 18:20

PureWeen

@@ -323,6 +323,28 @@ public static void RegisterStylesheets(InitializationFlags flags)
return properties;
}
internal static void RegisterEffects(Assembly[] assemblies)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This moves the register effects code to its own method so it's not getting called along side the other registration calls

PureWeen

@@ -11,6 +11,10 @@ protected RoutingEffect(string effectId)
Inner = Resolve(effectId);
}
protected RoutingEffect()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you register your effect via the builder you don't need to use an EffectId. I thought about creating a different base class but didn't want to require that of the user

Redth

rookiejava added a commit to rookiejava/maui that referenced this pull request

Jul 14, 2021

@rookiejava

rookiejava added a commit to rookiejava/maui that referenced this pull request

Jul 16, 2021

@rookiejava

rookiejava added a commit to rookiejava/maui that referenced this pull request

Jul 20, 2021

@rookiejava

rookiejava added a commit to rookiejava/maui that referenced this pull request

Aug 4, 2021

@rookiejava

rookiejava added a commit to rookiejava/maui that referenced this pull request

Aug 4, 2021

@rookiejava

rookiejava added a commit to rookiejava/maui that referenced this pull request

Aug 9, 2021

@rookiejava

rookiejava added a commit to rookiejava/maui that referenced this pull request

Aug 11, 2021

@rookiejava

shyunMin pushed a commit to shyunMin/maui that referenced this pull request

Aug 22, 2021

@rookiejava

shyunMin pushed a commit to shyunMin/maui that referenced this pull request

Aug 22, 2021

@rookiejava

rookiejava added a commit to rookiejava/maui that referenced this pull request

Apr 8, 2022

@rookiejava

rookiejava added a commit to rookiejava/maui that referenced this pull request

Apr 10, 2022

@rookiejava

rookiejava added a commit to rookiejava/maui that referenced this pull request

Apr 11, 2022

@rookiejava

rookiejava added a commit to rookiejava/maui that referenced this pull request

Apr 11, 2022

@rookiejava

rookiejava added a commit to rookiejava/maui that referenced this pull request

Apr 12, 2022

@rookiejava

rookiejava added a commit to rookiejava/maui that referenced this pull request

Apr 13, 2022

@rookiejava

rookiejava added a commit to rookiejava/maui that referenced this pull request

Apr 13, 2022

@rookiejava

rookiejava added a commit to rookiejava/maui that referenced this pull request

Apr 14, 2022

@rookiejava

mattleibow pushed a commit that referenced this pull request

Apr 15, 2022

Co-authored-by: 허강호/Common Platform Lab(SR)/Principal Engineer/삼성전자 kangho.hur@samsung.com

This reverts commit c54ac83.

This commit will be revert when upstream code is updated

Co-authored-by: 허강호/Common Platform Lab(SR)/Principal Engineer/삼성전자 kangho.hur@samsung.com

Co-authored-by: 허강호/Common Platform Lab(SR)/Principal Engineer/삼성전자 kangho.hur@samsung.com

Co-authored-by: 허강호/Common Platform Lab(SR)/Principal Engineer/삼성전자 kangho.hur@samsung.com

Co-authored-by: 허강호/Common Platform Lab(SR)/Principal Engineer/삼성전자 kangho.hur@samsung.com

Co-authored-by: 허강호/Common Platform Lab(SR)/Principal Engineer/삼성전자 kangho.hur@samsung.com

Co-authored-by: Jay Cho chojoong@gmail.com

Co-authored-by: JoonghyunCho jh5.cho@samsung.com Co-authored-by: Seungkeun Lee sngn.lee@samsung.com Co-authored-by: 김성수/Common Platform Lab(SR)/Staff Engineer/삼성전자 sung-su.kim@samsung.com Co-authored-by: 박인서/Common Platform Lab(SR)/Associate/삼성전자 inseo9.park@samsung.com Co-authored-by: 민성현/Common Platform Lab(SR)/Staff Engineer/삼성전자 shyun.min@samsung.com Co-authored-by: Jay Cho chojoong@gmail.com

myroot added a commit to myroot/maui that referenced this pull request

Aug 24, 2022

Co-authored-by: 허강호/Common Platform Lab(SR)/Principal Engineer/삼성전자 kangho.hur@samsung.com

This reverts commit c54ac83.

This commit will be revert when upstream code is updated

Co-authored-by: 허강호/Common Platform Lab(SR)/Principal Engineer/삼성전자 kangho.hur@samsung.com

Co-authored-by: 허강호/Common Platform Lab(SR)/Principal Engineer/삼성전자 kangho.hur@samsung.com

Co-authored-by: 허강호/Common Platform Lab(SR)/Principal Engineer/삼성전자 kangho.hur@samsung.com

Co-authored-by: Jay Cho chojoong@gmail.com

Co-authored-by: Jay Cho chojoong@gmail.com

Co-authored-by: Jay Cho chojoong@gmail.com

Co-authored-by: Kangho Hur kangho.hur@samsung.com Co-authored-by: 조중현/Common Platform Lab(SR)/Engineer/삼성전자 jh5.cho@samsung.com Co-authored-by: 김성수/Common Platform Lab(SR)/Staff Engineer/삼성전자 sung-su.kim@samsung.com Co-authored-by: 박인서/Common Platform Lab(SR)/Associate/삼성전자 inseo9.park@samsung.com Co-authored-by: 민성현/Common Platform Lab(SR)/Staff Engineer/삼성전자 shyun.min@samsung.com Co-authored-by: Jay Cho chojoong@gmail.com

myroot added a commit to myroot/maui that referenced this pull request

Aug 24, 2022

Co-authored-by: 허강호/Common Platform Lab(SR)/Principal Engineer/삼성전자 kangho.hur@samsung.com

This reverts commit c54ac83.

This commit will be revert when upstream code is updated

Co-authored-by: 허강호/Common Platform Lab(SR)/Principal Engineer/삼성전자 kangho.hur@samsung.com

Co-authored-by: 허강호/Common Platform Lab(SR)/Principal Engineer/삼성전자 kangho.hur@samsung.com

Co-authored-by: 허강호/Common Platform Lab(SR)/Principal Engineer/삼성전자 kangho.hur@samsung.com

Co-authored-by: Jay Cho chojoong@gmail.com

Co-authored-by: Jay Cho chojoong@gmail.com

Co-authored-by: Jay Cho chojoong@gmail.com

Co-authored-by: Kangho Hur kangho.hur@samsung.com Co-authored-by: 조중현/Common Platform Lab(SR)/Engineer/삼성전자 jh5.cho@samsung.com Co-authored-by: 김성수/Common Platform Lab(SR)/Staff Engineer/삼성전자 sung-su.kim@samsung.com Co-authored-by: 박인서/Common Platform Lab(SR)/Associate/삼성전자 inseo9.park@samsung.com Co-authored-by: 민성현/Common Platform Lab(SR)/Staff Engineer/삼성전자 shyun.min@samsung.com Co-authored-by: Jay Cho chojoong@gmail.com

myroot pushed a commit to myroot/maui that referenced this pull request

Aug 24, 2022

@rookiejava @myroot

myroot pushed a commit to myroot/maui that referenced this pull request

Aug 24, 2022

@rookiejava @myroot

myroot pushed a commit to myroot/maui that referenced this pull request

Aug 25, 2022

@rookiejava @myroot

myroot pushed a commit to myroot/maui that referenced this pull request

Aug 25, 2022

@rookiejava @myroot

rmarinho pushed a commit that referenced this pull request

Aug 26, 2022

Co-authored-by: 허강호/Common Platform Lab(SR)/Principal Engineer/삼성전자 kangho.hur@samsung.com

This reverts commit c54ac83.

This commit will be revert when upstream code is updated

Co-authored-by: 허강호/Common Platform Lab(SR)/Principal Engineer/삼성전자 kangho.hur@samsung.com

Co-authored-by: 허강호/Common Platform Lab(SR)/Principal Engineer/삼성전자 kangho.hur@samsung.com

Co-authored-by: 허강호/Common Platform Lab(SR)/Principal Engineer/삼성전자 kangho.hur@samsung.com

Co-authored-by: Jay Cho chojoong@gmail.com

Co-authored-by: Jay Cho chojoong@gmail.com

Co-authored-by: Jay Cho chojoong@gmail.com

Co-authored-by: Kangho Hur kangho.hur@samsung.com Co-authored-by: 조중현/Common Platform Lab(SR)/Engineer/삼성전자 jh5.cho@samsung.com Co-authored-by: 김성수/Common Platform Lab(SR)/Staff Engineer/삼성전자 sung-su.kim@samsung.com Co-authored-by: 박인서/Common Platform Lab(SR)/Associate/삼성전자 inseo9.park@samsung.com Co-authored-by: 민성현/Common Platform Lab(SR)/Staff Engineer/삼성전자 shyun.min@samsung.com Co-authored-by: Jay Cho chojoong@gmail.com

Co-authored-by: Kangho Hur kangho.hur@samsung.com Co-authored-by: 조중현/Common Platform Lab(SR)/Engineer/삼성전자 jh5.cho@samsung.com Co-authored-by: 김성수/Common Platform Lab(SR)/Staff Engineer/삼성전자 sung-su.kim@samsung.com Co-authored-by: 박인서/Common Platform Lab(SR)/Associate/삼성전자 inseo9.park@samsung.com Co-authored-by: 민성현/Common Platform Lab(SR)/Staff Engineer/삼성전자 shyun.min@samsung.com Co-authored-by: Jay Cho chojoong@gmail.com

rmarinho pushed a commit that referenced this pull request

Aug 26, 2022

Co-authored-by: 허강호/Common Platform Lab(SR)/Principal Engineer/삼성전자 kangho.hur@samsung.com

This reverts commit c54ac83.

This commit will be revert when upstream code is updated

Co-authored-by: 허강호/Common Platform Lab(SR)/Principal Engineer/삼성전자 kangho.hur@samsung.com

Co-authored-by: 허강호/Common Platform Lab(SR)/Principal Engineer/삼성전자 kangho.hur@samsung.com

Co-authored-by: 허강호/Common Platform Lab(SR)/Principal Engineer/삼성전자 kangho.hur@samsung.com

Co-authored-by: Jay Cho chojoong@gmail.com

Co-authored-by: Jay Cho chojoong@gmail.com

Co-authored-by: Jay Cho chojoong@gmail.com

Co-authored-by: Kangho Hur kangho.hur@samsung.com Co-authored-by: 조중현/Common Platform Lab(SR)/Engineer/삼성전자 jh5.cho@samsung.com Co-authored-by: 김성수/Common Platform Lab(SR)/Staff Engineer/삼성전자 sung-su.kim@samsung.com Co-authored-by: 박인서/Common Platform Lab(SR)/Associate/삼성전자 inseo9.park@samsung.com Co-authored-by: 민성현/Common Platform Lab(SR)/Staff Engineer/삼성전자 shyun.min@samsung.com Co-authored-by: Jay Cho chojoong@gmail.com

@ghost ghost added the legacy-area-controls

Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor

label

Jul 11, 2023