Hi,
I'm testing a component that search the grid and, in order to do this, am populating a DataTable with random data and assigning it as the DataSource on a UltraGrid. However, it appears the grid doesn't do anything with the data. Is this possible, or is the grid only functional on a form?
[TestFixture]
public class UltraGridSearcherFixture
{
private struct ColumnLabels
public static string Qty = "Qty";
}
[Test]
const int ROW_COUNT = 1000;
new DataColumn(ColumnLabels.Id, typeof(Guid)),
);
DataRow newRow = data.NewRow();
newRow[ColumnLabels.Qty] = rnd.Next(-100, 100);
#endregion
grid.DataSource = data;
grid.DataBind();
The grid is never going to paint here, so it will never actually do anything with the data. You will need to put the grid on a form and show that form; I also tend to dock the grid to Fill as well to ensure that it's visible when doing unit tests.
-Matt
Actually, it might be that the grid simply doesn't have a BindingContext since it's not on a form. Try setting grid.BindingContext = new object() and see if that helps.
If it is, in fact, an issue of painting, you might try calling grid.Refresh to force a paint.