Open IranthaJ opened 4 years ago
I got to know that we can use customized TableHeaderAdapter as our Data adapter. I was successful with the following example
public class CustomTableHeaderAdapter : TableHeaderAdapter
{
public CustomTableHeaderAdapter(Context context)
{
super(context);
}
public override View GetHeaderView(int columnIndex, ViewGroup parentView)
{
switch( columnIndex )
{
case 0: return RenderCheckBox();
case 1: return RenderTextCell( "Column header");
default: return null;
}
}
private View RenderTextCell(string text)
{
var textView = new TextView(this.Context);
textView.Text = text;
return textView;
}
private View RenderCheckBox()
{
CheckBox checkBox = new CheckBox(this.Context);
checkBox.Click += HeaderCheckBox_Click;
return checkBox;
}
}
I am using this table view and trying to create a table with a header checkbox and checkbox for each row. Something like below;
I was able to render checkboxes in rows but could not find a way to set it in the header with 'SimpleTableHeaderAdapter'. Is there a way to include views in the header?
I only see these constructors;
Note: I am working with Xamarin C# - https://github.com/xamarin/XamarinComponents/tree/master/Android/SortableTableView