Giter VIP home page Giter VIP logo

Comments (6)

FreakyAli avatar FreakyAli commented on July 23, 2024 1

Well I don't know if there is a direct way to do this, but what you could do is recreate your version of this Validator the original code which can be found here: https://github.com/CommunityToolkit/Maui/blob/main/src/CommunityToolkit.Maui/Behaviors/Validators/TextValidationBehavior.shared.cs

And, you could add some code to this behaviour that gets the Entry reference through FindByName and then apply the behaviour accordingly, Name for the View is here:

So in the OnAttach method you would do something like this:

public class TextValidationBehavior : Behavior<FreakyTextInputLayout>
	{
        protected override void OnAttachedTo(FreakyTextInputLayout bindable)
        {
            base.OnAttachedTo(bindable);
            var entry = bindable.FindByName("EntryField");
        }
    }

There is also a BehvaviorBase implementation in FreakyControls that you can use to get the AssociatedObject without creating a reference for it manually:
https://github.com/FreakyAli/Maui.FreakyControls/blob/master/MAUI.FreakyControls/MAUI.FreakyControls/Shared/Behaviors/BehaviorBase.cs

Hope this makes sense,

Feel free to ask any questions that come to mind...

from maui.freakycontrols.

FreakyAli avatar FreakyAli commented on July 23, 2024 1

It's fine, do let me know if you face any issues, and I will try to help you out, how much ever i can!

from maui.freakycontrols.

FreakyAli avatar FreakyAli commented on July 23, 2024 1

@SalvatoreDiFede I will close this assuming you worked things out, you can always reopen this or create a new one if needed!

from maui.freakycontrols.

SalvatoreDiFede avatar SalvatoreDiFede commented on July 23, 2024 1

Thank'u @FreakyAli . Had no way nor time to implement this lately. Sorry

from maui.freakycontrols.

SalvatoreDiFede avatar SalvatoreDiFede commented on July 23, 2024

Oh, thanks, i'll try!

BTW my original idea was to set EntryField public and bindable and to add something like this:

[TypeConverter(typeof(Field))] public Field EntryField { get { return (Field)GetValue(EntryFieldProperty); } set { SetValue(EntryFieldProperty, value); } }

I apologize but my knowledge of this is very limited :(

from maui.freakycontrols.

FreakyAli avatar FreakyAli commented on July 23, 2024

@SalvatoreDiFede Did you get anywhere with this?

from maui.freakycontrols.

Related Issues (20)

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.