dataGrid.GetRowHeight(e.RowIndex);
DataGrid_QueryRowHeight
Do i have to do any special when working with CustomCells?
Please let me know if I should provide more code :)
public class CustomCell : GridCell
{
TextView textView;
public CustomCell(Context context) : base(context)
{
textView = new TextView(this.Context);
this.AddView(textView);
this.CanRenderUnLoad = false;
}
protected override void UnLoad()
{
if (this.Parent != null)
(this.Parent as VirtualizingCellsControl).RemoveView(this);
}
protected override void OnLayout(bool change, int l, int t, int r, int b)
{
this.textView.Layout(0, 0, this.Width, this.Height);
}
protected override void OnDraw(Canvas canvas)
{
base.OnDraw(canvas);
this.textView.Text = DataColumn.CellValue.ToString();
}
protected override double GetAutoHeight(object rowData)
{
string cellValue = (rowData as OrderInfo).CustomerID;
// return the desired value.
return base.GetAutoHeight(rowData);
}
} |
private void DataGrid_QueryRowHeight (object sender, QueryRowHeightEventArgs e)
{
if (e.RowIndex != 0) {
//Calculates and sets height of the row based on its content
e.Height = dataGrid.GetRowHeight(e.RowIndex);
e.Handled = true;
}
}
private void SfDataGrid_ColumnResizing(object sender, GridResizingEventArgs e)
{
if (e.ResizingState == ProgressStates.Completed)
sfDataGrid.Refresh();
} |
private void DataGrid_QueryRowHeight(object sender, QueryRowHeightEventArgs e)
{
// Code to skip querying of a row if already queried
if (e.Height != sfDataGrid.RowHeight)
return;
if (e.RowIndex != 0)
{
//Calculates and sets height of the row based on its content
e.Height = (sender as SfDataGrid).GetRowHeight(e.RowIndex);
e.Handled = true;
}
} |