DataGrid.RowCount throws InvalidOperationExceptionhere when ItemSource is empty collection.
public override T GetItem<T>(int row, int column, Func<BasicAutomationElementBase, T> wrap)
{
var nativeItem = Com.Call(() => this.NativePattern.GetItem(row, column));
if (nativeItem == null)
{
throw new InvalidOperationException("Did not find item.");
}
return wrap(new UIA3BasicAutomationElement((UIA3Automation)this.BasicAutomationElement.Automation, nativeItem));
}
DataGrid.RowCount throws
InvalidOperationException
here whenItemSource
is empty collection.If set
CanUserAddRows="False"
it works fine.