I have a Syncfusion schedule used in month view, but once I swipe to go to the next month the app crashes and shows me this error:
"Event registration is overwriting existing delegate. Either just use events or your own delegate: Foundation.NSObject UIKit.UIGestureRecognizer+UIGestureRecognizerDelegate"
This only happens on my iOS project and is fine on Android.
I have no custom renderers associated with the feature.
Would anyone know what is causing this?
iOS controls have some gesture events and if you use those gesture events you can't add gesture recognizes or the app will crash. So it is likely that SF control is using those events.
Related
I need a ListView with long pressed event handler.
When listviewItem is longpressed, an popup should appear for example.
Does anyone knows, if this is possible with xamarin.forms MVVM?
Thanks
There is a known issue about this in xamarin forms, you can check it here: [Enhancement] LongPressGestureRecognizer.
And just as this remark mentioned :
this will probably be in .NET MAUI but won't make it into
Xamarin.Forms anymore. If needed check out the Xamarin Community
Toolkit or other relevant libraries
But there are several workarounds:
You can refer to article: Longpress Event For Image In Xamarin.Forms.
And you can also check thread : How to make long press gesture in Xamarin Forms?
I have tried my UWP app on XBOX one which is built using xamarin.forms and it works generally fine but by default mouse mode is active. I changed it using
RequiresPointerMode = Windows.UI.Xaml.ApplicationRequiresPointerMode.WhenRequested;
on UWP level in app.xaml.cs and it disabled mouse pointer but problem is that using game pad, i am not able to select items on the UI. I can navigate through textbox and buttons but not Toolbar (Commandbar in uwp), ListView, Masterdetail, Tabs etc.
I created a blank native UWP application and added a commandbar with AppBarButtons and NavigationView with NavigationViewItems. It perfectly works, I am able to navigate between menu items and commanbaritems using mouse pad.
Why this is not working for Xamarin.Forms? is xamarin.forms not actually native for UWP?
Xamarin.Forms MasterDetailPage was written before NavigationView existed and it doesn't use it at all (and especially not with NavigationViewItems, that would limit the flexibility, i don't think it will ever be used).
As SplitView has some focus bug that I can confirm it doesn't come as a surprise that it doesn't work with XBox as expected. However UWP doesn't grant that the app will work properly when you disable the mouse mode with native controls, that's why it is enabled by default. There are properties like XYFocusLeft that must be set if the app is not working properly. You probably need to make custom renderer to expose those properties and set them right. That's pretty much of work to do but it is up to you to decide...
I just checked out consuming native UI iOS/Android controls in Xamarin Forms. One thing I don't understand is what events to specify as triggering an update for bindings. The article mentions UISwitch as an example and specifies the ValueChanged event for triggering updating bindings. But where can I find information about which events can be used for other iOS and Android controls?
As an example I tried UITextView and couldn't find any info on which events is being supported in the official docs. Some experimenting and I found I could use an event called "Changed", but there has to be some docs somewhere for this I guess. Antone know where?
iOS uses the delegate pattern heavily. UITextView uses the UITextViewDelegate - in native iOS you would provide your own delegate that is responsible for responding to events raised by the control
I'm working on inactivity detection.
I have successfully done so in iOS by subclassing UIApplication and overriding SendEvent as outlined here.
I know I could implement this separately for both iOS and Android, but I'd rather have a cross-platform Forms approach by intercepting all touch events and resetting my timers. I'd rather not have to add a touch event handler to all my pages either.
I was unable to find a cross platform approach. I was able to accomplish this by leaving the timer related information in core Forms project and implement the touch event handlers separately for iOS and Android. I handled the iOS touch events as outlined in the link in the OP, but for Android I took the approach of subclassing Activity due to the presence of the OnUserInteraction() method.
Initially I thought I would have to force Xamarin to use my subclassed Activity for all pages that I use in Xamarin, but I was mistaken. AdamMeaney over on the Xamarin forums was able to help with providing a solution for the Android side of things with regards to subclassing an Android activity. As it turns out, Xamarin only uses one Activity which inherits from Xamarin.Forms.Platform.Android.FormsAppCompatActivity. I used the MainAcitivty provided by Xamarin in the Droid project. From there, overriding the OnUserInteraction() proved to be quite simple:
public override void OnUserInteraction()
{
base.OnUserInteraction();
//Do other stuff
}
It would seem to me that all you really have to do on the platform side is get notified whenever a new touch event occurs. Unless I am missing something it seems you can do all of the timer stuff in the PCL core Forms project and call that code from the platform specific code that runs when a touch is detected.
So if on Android ( I did not verify, but I would assume so) there is a similar way to handle any touch, device wide, then it would seem that all you have to do is implement that event handler, as you did for iOS, and call into your Forms core code to handle the timer(s).
To clarify: On the platform side, just handle the touch events globally and then call into code in the Forms core thus only having to implement the timer functionality once. Or so it would seem unless I am missing something.
If you want to make a feature request for Xamarin Form, please do so at Xamarin's user voice page: xamarin.uservoice.com
I suspect Forms would just have to do as outlined above... handle device wide touches on each platform and then have a virtual method in Forms core code that is called whenever a touch occurs.
I have a Xamarin.Forms page with a map containing numerous pins. I've built a custom iOS renderer to change the image of the displayed pin.
Once I assign the GetViewForAnnotation delegate, my Xamarin.Forms class no longer receives the "Clicked" event. I can access it through the custom renderer, I do believe, but what I want to do when the user taps the title of the pin is push another Xamarin.Forms page to the navigation stack, and I don't know how to give control back to my Xamarin.Forms app from within my Xamarin.iOS app.
I have a feeling I'll need this type of logic in a few other places... where I need to handle a CustomRenderer event but then pass control back to the Xamarin.Forms app for navigation or other purposes.
So I have a couple directions I'd like to go:
1 - More straightforward - get my "Clicked" event to fire in the Xamarin.Forms app when the map's pin is clicked, even though the iOS app is handling the creation of the pin via a CustomRenderer
2 - More advanced and customizable - pass control back to my Xamarin.Forms app (maybe raise an event related to the Renderer level?)
I'd prefer at this time to just get my Clicked event back, but I'm guessing that may not work once I assign the GetViewForAnnotation event in the CustomRenderer.
From what I read, you can detect the annotation click within your renderer.
Within your renderer in the OnElementChanged you can get access to the View in the Xamarin.Forms PCL it relates to.
A few possibilities to consider going forward:-
a) Use MessagingCenter to convey messaging between interests (see
here).
b) Use the standard event raising, i.e. public event
EventHandler<someEventArgs> OnSomeEvent through your View in your
PCL.
c) Use an ICommand approach on your View in your PCL if your
more MVVM orientated, and invoke this way instead.
Once you have your notification back through your View / Page, depending on where your doing things, you can then do a normal navigation based on the information you have been given from your platform-specific renderer in the PCL.