Make XAF Listview editable using interface ICanEditInLine

At first glance I thought a property named View.AllowEdit would be a flag to enable or disable editing.

However it is not that simple.

So instead I wrote a controller to make any entity that implements ICanEditInLine become editable.

	public partial class InLineEditController : ViewController
	{
		public InLineEditController()
		{
			InitializeComponent();
			TargetObjectType = typeof(ICanEditInLine);
		}
		private void ViewOnControlsCreated(object sender, EventArgs eventArgs)
		{
			var listView = View as ListView;
		    if (!(listView?.Editor is GridListEditor editor)) return;
			var allowEdit = !(Frame.Template is ILookupPopupFrameTemplate);
			editor.NewItemRowPosition = NewItemRowPosition.Bottom;
			editor.AllowEdit = View.Model.AllowEdit = allowEdit;
		}
		protected override void OnActivated()
		{
			base.OnActivated();
			View.ControlsCreated += ViewOnControlsCreated;
			 ((dynamic)(View.Model)).NewItemRowPosition = NewItemRowPosition.Bottom;
		}
		 
		protected override void OnDeactivated()
		{
			base.OnDeactivated();
			View.ControlsCreated -= ViewOnControlsCreated;
		}
	}

	public interface ICanEditInLine
	{
	}

Now I have commented out the dynamic

//((dynamic)(View.Model)).NewItemRowPosition = NewItemRowPosition.Bottom;

Because I did not want to have a dependency on Microsoft.CSharp