Xamarin\'s ListView
defines a 1-argument constructor as follows:
public ListView([Parameter(\"CachingStrategy\")] ListViewCachingStrategy cachin
To make things simpler, I would recommend creating a BindableProperty for IsReadOnly
. But you can always use x:Arguments to pass in parameters to constructor:
<local:ItemListControl ...>
<x:Arguments>
<x:Boolean>true</x:Boolean>
</x:Arguments>
</local:ItemListControl>
EDIT - 1
There is one hack that you can use - (I wouldn't recommend as this could change anytime with an update in XAMLC compilation) - but you can make sure to keep the namespace same as the one used internally while defining the parameter attribute.
namespace Xamarin.Forms
{
[AttributeUsage(AttributeTargets.Parameter)]
internal sealed class ParameterAttribute : Attribute
{
public ParameterAttribute(string name)
{
Name = name;
}
public string Name { get; }
}
}
And XAML usage would look like:
<local:ItemListControl IsReadOnly="true" .. />
EDIT - 2 This hack only seems to work if XAMLCompilation is applied to host control/page.