Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
150645 | Jan 14,2020 12:52 PM UTC | Jan 20,2020 05:43 AM UTC | Xamarin.Android | 6 |
![]() |
Tags: SfDataGrid |
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;
}
} |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.