C
C#8mo ago
AK sanTari

❔ MvvmCross - MvxRecyclerView GetChildAt(position) returns null

i have a problem where GetChildAt returns null for all elements out of view ( i have a MvxRecyclerView with many elements and they don't all fit in the screen - have a scroll component) GetChildAt work only on all elements that are visible (fit in the screen) when i click a certain button. There are solution for java/javascript apps but they don't work with xamarin. Anybody has any idea how to make it work?
c#
[Activity()]
public class MyView : MvxActivity<MyViewModel>
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
///...some code
Button btnSave = FindViewById<Button>(Resource.Id.SaveButton);
btnSave.Click += async delegate {
var signatoryList = FindViewById<MvxRecyclerView>(Resource.Id.signatoryList);

int position = 0;
bool signaturesSaved = false;

foreach (Signatory signatory in signatoryList.ItemsSource)
{
try
{
RecyclerView.ViewHolder holder = signatoryList.FindViewHolderForItemId(Resource.Id.signatoryList);
View signatoryView = signatoryList.GetChildAt(position);
signaturePad = signatoryView.FindViewById<SignaturePadView>(Resource.Id.signatureImage);

///... save the signature byte array

c#
[Activity()]
public class MyView : MvxActivity<MyViewModel>
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
///...some code
Button btnSave = FindViewById<Button>(Resource.Id.SaveButton);
btnSave.Click += async delegate {
var signatoryList = FindViewById<MvxRecyclerView>(Resource.Id.signatoryList);

int position = 0;
bool signaturesSaved = false;

foreach (Signatory signatory in signatoryList.ItemsSource)
{
try
{
RecyclerView.ViewHolder holder = signatoryList.FindViewHolderForItemId(Resource.Id.signatoryList);
View signatoryView = signatoryList.GetChildAt(position);
signaturePad = signatoryView.FindViewById<SignaturePadView>(Resource.Id.signatureImage);

///... save the signature byte array

1 Reply
Accord
Accord8mo ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.