MR.Gestures handles ALL touch gestures

15678911»

Posts

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭✭

    @KaranRami93 said:
    I need to get commandparameter and eventargs both.

    Then don't use the *CommandParameter, but try to get the needed data out of the EventArgs.
    The EventArgs contain a property Sender for the Element which raised the event. Each Element has a BindingContext which can be any object. So just add a property with your equipmentobj to your ViewModel. If using the BindingContext is too complicated, the AutomationId might be misused for this purpose. But this property is only a string.

  • DeepakDYDeepakDY INMember ✭✭

    Hello @MichaelRumpler,

    I want to swipe content view by grid Swipe Gesture any code or solution for that

  • DeepakDYDeepakDY INMember ✭✭

    Hello @MichaelRumpler

    I am getting always swipe position "NotClear".
    if (e.Direction == MR.Gestures.Direction.Right)
    {
    ///-----
    }

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭✭

    @DeepakDY
    There are plenty of examples in the GestureSample - including a Grid. But all elements work the same.

    Did you set the LicenseKey properly? See the FAQs.

  • DeepakDYDeepakDY INMember ✭✭

    Hello @MichaelRumpler,

    its my grid

         `<mr:Grid Swiped="Grid_Swiped" HorizontalOptions="FillAndExpand"  VerticalOptions="FillAndExpand">
    

    `

    Its my method

    'private void Grid_Swiped(object sender, MR.Gestures.SwipeEventArgs e)
    {

            if (e.Direction == MR.Gestures.Direction.Right)
            {
                if (!App.IsOpen)
                {
                    MessagingCenter.Send<string>(Convert.ToString(""), "Opacity");
                    menuContainer.TranslateTo(0, 0, 500);
                    menuContainer.IsVisible = true;
                    App.IsOpen = true;
                }
    
                else
                {
                    //menuContainer.IsVisible = false;
                    menuContainer.TranslateTo(-700, 0, 0);
                    App.IsOpen = false;
                }
            }
        }
    

    '

    i am getting e.Direction "NotClear"

    any solution for that

    Sorry for my bad english

  • DeepakDYDeepakDY INMember ✭✭

    Hello @MichaelRumpler,

    Now i am able to get direction of swipe event :smile: .
    it's fix by set licence key.
    but my one question to you.
    i used android:label="GestureSample" then it's work.
    i could not used my project name how can resolve it :( .

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭✭

    @DeepakDY said:
    i used android:label="GestureSample" then it's work.
    i could not used my project name how can resolve it :( .

    Buy a license and use the license key for your app name.

  • KaranRami93KaranRami93 Member ✭✭

    @MichaelRumpler

    I need to add pan gesture inside scrollview content. Currently i am able to pan my content horizontally but vertical panning is not happening, and panned method getting executes.

    i am aware of that scroll view has vertical gestures and that is causing this issue.

    But if you have any suggestion or solution for this, please share.

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭✭

    @KaranRami93

    The ScrollView is highly optimized on every platform. Thus they consume some gestures and don't raise the usual events and I don't get notified when something happens.

    You didn't say on which platform you tried it. As you can imagine, this is also different on each platform. On Android everything should work as expected. For Windows I asked a question on Stack Obverflow back in 2015. Although the question is about Windows 8.1 it still behaves the same on UWP and the question is unanswered.

    Of course you could remove the ScrollView and use a ContentView instead. There you could handle Panning and scroll your content manually. But this would remove the scrollbars and might be too slow in your case.

  • I'm trying to assign panning event to an element "programmatically", and it works if i assign it at the start of the program, but when i try to do it after i await an async function it doesn't get assigned, i've tried the "Up" event and that works fine. The same thing happens when i make a button click call a function which assigns a "Panning" event to an element it doesn't work, but assigning the "Up" event works fine, ("Panning" event also works fine if just assign the event normally, instead of making a button click call a function which then assigns the event).

    The code is in the "pcl" part of the xamarin project and i'm using a .NETStandard project and building an UWP app.

    Has anyone had this experience or can tell me what might being going wrong?

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭✭

    @sigvordr This should work. Could you please send me a repro project.

  • @MichaelRumpler I sent you an email with a link to project.

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭✭
    edited September 2018

    @sigvordr said:
    I'm trying to assign panning event to an element "programmatically", and it works if i assign it at the start of the program, but when i try to do it after i await an async function it doesn't get assigned, i've tried the "Up" event and that works fine.

    I debugged your repro project and found out that the Button does not raise a PropertyChanged event when you assign an event handler to Panning (or any other events). I will fix this in the next version.

    In the meantime you can use the PanningCommand instead. It suffices if you just assign a noop to the command. This will raise PropertyChanged and then the Panning event handler will also be executed. In your repro project that would be

    this.test_2.PanningCommand = new Command(() => { });
    

    I'll be on vacation next week, so the new version will have to wait until I come back.

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭✭

    I just released version 2.1.0.

    • This version also adds support for the FlexLayout.

    • As Xamarin.Forms added ScaleX and ScaleY properties, I also added those to the PinchEventArgs.
      The PinchEventArgs now also have DeltaScaleX, DeltaScaleY, DistanceX, DistanceY, TotalScaleX and TotalScaleY properties.
      Two fingers can never get too near to each other, but two X and/or Y coordinates can. So the Distance cannot get too small, but DistanceX could change from 1 to 5 which would mean a DeltaScaleX of 5. So this cannot be a simple copy of the Scale properties, it needed special handling.
      I added a threshold. If DistanceX/Y are below MR.Gestures.Settings.MinimumDistanceForScale, then DeltaScaleX/Y will be 1.0. The default value for MinimumDistanceForScale is 10, but you can adjust it as you like.

    • The bug @sigvordr reported above that PropertyChanged was not raised when assigning an event handler has been fixed.

    • And I also fixed a bug the the PanEventArgs had TotalDistance, DeltaDistance and Velocity set to 0/0 when Panning was raised the first time.

    These changes also found their way into the GestureSample. I added these pages to it:

    • Layouts/FlexLayout
    • Tests/DynamicallyAddHandler.xaml
    • Tests/FrameScaleXYXaml.xaml
    • Tests/PrintFirstPanning.xaml

    With this release I also want to change the way how issues are reported. I used this forum post until now and closed the issues for the GestureSample because that was for the GestureSample. But this post grew too big. You cannot find anything anymore, so I decided to just misuse the GestureSample issues for MR.Gestures too.
    Of course you can still send me an email with any sensitive information or repro projects.

15678911»
Sign In or Register to comment.