Hello,
To reproduce the error do the following:
1- Select the skin WXI or WXI Compact
2- Open the Form which contains the TokenEdit
assigning the data.
3- Upon reaching the line where the property is configured, the exception error will be thrown.
C#class Data
{
public int Id { get; set; }
public string Description { get; set; }
}
List<Data> myList = new List<Data>
{
new Data { Id = 1, Descripcion = "SomeData1" },
new Data { Id = 21, Descripcion = "SomeData2" },
//....
};
tokenEdit1.Properties.DisplayMember = "Description";
tokenEdit1.Properties.ValueMember = "Id";
tokenEdit1.Properties.DataSource = myList;
tokenEdit1.MaskBox.Enabled = false; ///ERROR HERE
NullReferenceException:
C#System.NullReferenceException: 'Object reference not set to an instance of an object.'
If you use any other skin it will work correctly, now do it the other way around:
1- Apply any other skin example: The Bezier.
2- Open the form and the property will be applied correctly.
3- Then apply the WXI or WXI Compact skin, the error will NOT occur, but the previous configuration of the MaskBok will not work and will allow entering text.
In the meantime to avoid the error, I validate that the property is not null before applying it, although this does not solve the problem of still allowing the user to enter text.
Codeif (tokenEdit1.MaskBox != null)
tokenEdit1.MaskBox.Enabled = false;
Please check if this also happens on your side.
Thank you…