adospace / reactorui-maui

MauiReactor is a MVU UI framework built on top of .NET MAUI
MIT License
588 stars 49 forks source link

What is the 'OnTapped Method' difference? #206

Closed lukewire129 closed 7 months ago

lukewire129 commented 7 months ago

image

Grid Available CollectionView Unavailable

I've followed the reference, but I'm using the same 'CellExtensions', but I'm not seeing the Why is this happening?

EmptyItemArea Method

void EmptyItemArea(bool isItem = false)
{

}
adospace commented 7 months ago

OnTapped is an event, you should pass a callback like .OnTapped(()=>...) or .OnTapped(MyMethod)

lukewire129 commented 7 months ago

Will it be difficult to work with parameters in the future?

adospace commented 7 months ago

do you mean the arguments of the OnTapped event? if so any event in MauiReactor allows you to access event args using code like this:

.OnTapped((s, e)=> e. is of type TappedEventArgs)

or

.OnTapped(MyEvent)

void MyEvent(object? sender, TappedEventArgs args)
{
...
}
lukewire129 commented 7 months ago

Ahhh! I thought I understood OnTapped as follows. https://learn.microsoft.com/en-us/dotnet/maui/fundamentals/gestures/tap?view=net-maui-8.0

I was asking if it would be possible to customize it to be similar to Command and CommandParameter :)

adospace commented 7 months ago

Ok, I see now what you mean. To fully customize the tap gesture you have to create a TapGestureRecognizer like the following:

CollectionView(
    TapGestureRecognizer()
        .Buttons(MauiControls.ButtonsMask.Secondary)
        .NumberOfTapsRequired(2)
        .OnTapped(()=>...)
    )
    .ItemsSource(ItemsSource, RenderItem)

In the future, please provide a more descriptive explanation of your issues

lukewire129 commented 7 months ago

Thank you :)