ArgumentOutOfRangeException on Android Nougat when changing Grouped ItemSource - xamarin.forms

The first ItemSource has one section and the ItemSource that is switched to has two sections. It seems like Xamarin.Forms is looking for the section at index 1 in the first ItemSource (the one with only one section) and fails. See bugzilla for more information and reproduction project.
Only occurs on Android Nougat. I can post code if necessary but it's all in bugzilla already.

So it turns out that this was related to having accessibility services turned on. This forced the ListView to try to access items before the internal items of the adapter were updated, resulting in the ArgumentOutOfRange exception.

Related

Multiple of the same view model are being created

In my Xamarin.Forms application, I have 1 page and am setting the view model in the xaml as such:
<ContentPage.BindingContext>
<vm:MainViewModel />
</ContentPage.BindingContext>
The problem is, that when I put the app in the background and then open it again, I have 2 instances of MainViewModel. I can see with the debugger that a new one is created, but also code from the first one (before I put it in the background) is still being called (from event handlers).
How can I fix this? Is it possible to retain and use the same view model? Or am I forced to have a new one every time I close and reopen the app? If so, how do I make sure the old one is released from memory?
I'm running the app on an Android device.
This sounds like a regression bug, since it was reported/fixed multiple times.
I have a similar thread here on SO : Xamarin.Forms ViewModelLocator get called twice
Don't set the BindingContext in XAML unless it is a one page app, instead consider using an IoC container.

Daydream keyboard implementation

I am attempting to implement the Daydream keyboard into an app built in Unity and am not able to get this to work. I have added the keyboard prefab as a sibling of the main camera and added two input fields with the onpointerclick function added as instructed. I however get a null reference exception and assume this is due to the daydream keyboard delegate field being blank. The example scene in the SDK shows the daydream delegate example prefab but I am unsure how to implement this for two input fields. Also does the keyboard render in the Unity editor or must it be built and run on a phone?
This is an old question and has probably already been answered, but I figured I'd publicize my answer anyway.
For those reading, if you haven't checked out the Keyboard Demo scene that can be found within the Demos folder of the Google VR Unity package, I would highly recommend doing so. Following this object hierarchy has worked for me in the past.
To answer your first question, it seems that they have included a KeyboardDelegateExample object within the scene's hierarchy, and then used this object as the Keyboard Delegate in the GVRKeyboardManager.
They manage to fake an Input Field by creating a background and overlaying a Text object on top. If this method does not suffice and using an Input Field is crucial in your particular case, then drop your Input Fields into two separate GVRKeyboardCanvas objects.
Clicking on either canvas will activate the GVR Keyboard. You may have to add a small script to manage the transitioning of the input field.
Lastly, no the GVR Keyboard does not render in the Unity Editor, it only appears while running a build. Hopefully this will be addressed in later releases. There are also Keyboard plugins that you may find useful on the Asset Store.

Xamarin Forms ListView scrolled to top?

I have a InfiniteListView which extend ListView from Xamarin Forms.
I know when you on the last item in the list but how can i figure out if the user scrolled to the top of the list ?
Unfortunately, the Xamarin Forms ListView does not expose a Scrolled event or Position property. So your only option is to use the ItemAppearing and ItemDisappearing events.
When you subscribe to these events, you can figure out if the first cell is appearing again, after it disappeared first. This does not actually give you a 100% correct outcome, since it can happen that only a part of the first cell is shown.
If you want a perfect check that you are at the absolute top, you will have to resort to a custom renderer:
On iOS you can make use of the tableView.contentOffset.y property on the UITableView.
On Android it's a little bit more involved, as there are multiple (but no straightforward) ways to achieve this. See this answer for one possibility. This approach is originally meant for saving and restoring scroll position, so adjust it to your needs.
Other platforms have similar ideas. Check which native control the Xamarin Forms renderer creates, and then search the internet for possible solutions for that specific platform.

(RADGrid ItemCommand Event) Cannot Get Values From Cells?

I am having a strange problem. First let me start by saying that I am using the Telerik controls supplied by DotNetNuke. So I can not "upgrade" to any other version of the Telerik controls. I am stuck with what I am given.
I wrote a module initially using DNN v06.02.09 (Telerik v2012.2.724.35) and it worked great. I unfortunately am forced to upgrade to a newer DNN version because of a bug found in this particular version of Telerick's RADScheduler (which effects the month of November only). So...now I am running DNN v07.00.06 (Telerik v2013.1.403.40). [Note: I also tested this with the most recent DNN v7.04.01 (Telerik v????) and confirmed the same behavior described below]
Previously when I clicked on a button inside the RADGrid and the ItemCommand event fires I was able to obtain the value of each cell in the row that the button was activated in. The same exact code running in DNN v7.x now returns "nbsp;" for every single cell in the row. It's like the new Telerik version doesn't bind the data to the GridDataItem (e.Item) within the ItemCommand event like it used to.
What am I missing? How do I get the selected row's data like I had before?
Ok, so after scouring the internet and trying everything I could think of to fix this...I stumbled across the following "article"... http://www.telerik.com/forums/breaking-change-hidden-column-cell-text-is-not-persisted-in-viewstate
You would think they would make this stuff easier to find. Apparently the ".Visible" property's behavior was changed, so that if the column is not visible, it also does not bind data. They created a new property called ".Display" that would hide the column but still bind the data. I had to change my code to use the new property and then the grid's behavior was returned to what it was previously.

Flex - MATE Framework

I am new to MATE framework and I have been digging around some sample codes so that i can do the following:
On clicking a button (on a canvas)
Display a Panel.
The issue is that i am not trying to pass any value hence not sure of how/ what should be defined as sourcekey and targetkey. If this is the case, then how should one define the propertyinjector details.
most examples that are floating around contains details of reading data from a source and populating the same on a UI/ Display component.
Thanks
Srinivasan S
for this one you shouldn't use propertyInjection you should dispatch an event (you can make it custom), then you need to catch the event in the appropriate place and simply do whatever you want with it.

Resources