Xamarin Exception on showing hidden soft keyboard

Henning Richter 96 Reputation points
2021-03-22T12:11:00.533+00:00

Hi,
I am using Xamarin Forms 5.0.0.2012 in combination with Devexpress Xamarin Form 20.2.5 for an Android 8.1 device.
I am getting quite regularly the following exception when switching between input field and enter data within a DataFormView.
On my Android device I've hidden the virtual Keyboard globally (not part of my code).

Basically my Object look the follwoing:
[public abstract class Base : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged([CallerMemberName] string name = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
}

        string baseObject;  
        public string BaseObjectField { get => baseObject; set { baseObject = value; OnPropertyChanged(); } }  
}  
  
public class InheritedObject : Base  
{  
        [DataFormDisplayOptions(LabelText = "Fermenter", LabelPosition = DataFormLabelPosition.Top,  IsReadOnly = false)]  
        [DataFormItemPosition(RowOrder = 1, ItemOrderInRow = 2)]  
        [DataFormComboBoxEditor(InplaceLabelText = "choose", IsFilterEnabled = true)]  
        [ClearData]  
        public new string BaseObjectField  
        {  
                get => base.BaseObject;  
                set   
                {   
                        base.BaseObject = value;   
                           if(value != null)   
                                SomeOtherField = GetValue(value);  
                }  
        }  
        decimal? someotherfield;  
        public decimal? SomeOtherfField { get => someotherfield; set { someotherfield = value; OnPropertyChanged() } }  
  
}  
  
public class ComboBoxDataProvider : IPickerSourceProvider  
{  
    private Base baseobj;  
    public ComboBoxDataProvider(Base base)  
    {  
        baseobj = base;  
    }  
  
    public IEnumerable GetSource(string propertyName)  
    {  
        if(propertyName.Equals("BaseObjectField")  
        {  
            return LocalDataStore.Instance.Lookups.BaseObjects.Select(x => x.Name);  
        }  
    }    
}  
  
public class GenericModelPage<T> : ContentPage where T : Base, new()   
{  
    var masterForm = new DataFormView()  
    {  
        CommitMode = CommitMode.PropertyChanged,  
        ValidationMode = CommitMode.LostFocus  
    };  

    var dto = new T();  
    BindingContext = _viewModel = new GenericViewModel<T>(Navigation,  this)  
    {  
        DtoObject = dto  
    }  
    masterForm.DataObject = dto;  
    masterForm.PickerSourceProvider = new ComboBoxDataProvider(dto)  
}][1]  
Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,293 questions
{count} votes

0 additional answers

Sort by: Most helpful