|
this.dataForm.LayoutManager = new DataFormLayoutMaagerExt(this.dataForm);
this.dataForm.DataObject = new ContactsInfo();
public class DataFormLayoutMaagerExt: DataFormLayoutManager
{
public DataFormLayoutMaagerExt(SfDataForm dataForm):base(dataForm)
{
}
protected override View GenerateViewForLabel(DataFormItem dataFormItem)
{
var label = base.GenerateViewForLabel(dataFormItem);
if (label is Label)
{
(label as Label).BackgroundColor = Color.Red;
(label as Label).TextColor = Color.Blue;
}
return label;
}
protected override void OnEditorCreated(DataFormItem dataFormItem, View editor)
{
if (editor is Entry)
(editor as Entry).TextColor = Color.Orange;
editor.BackgroundColor = Color.Blue;
}
} |
|
[C#]
dataForm.RegisterEditor("Text", new CustomDataFormTextEditor(dataForm));
public class CustomDataFormTextEditor : DataFormTextEditor
{
public CustomDataFormTextEditor(SfDataForm dataForm) : base(dataForm)
{
}
protected override void OnInitializeView(DataFormItem dataFormItem, Entry view)
{
base.OnInitializeView(dataFormItem, view);
if(dataFormItem.Name == "Email")
{
view.IsReadOnly = true;
view.TextColor = Color.Red;
}
else
{
view.TextColor = Color.Green;
}
}
} |
|
public class DataFormTextEditorExt : DataFormTextEditor
{
public DataFormTextEditorExt(SfDataForm dataForm) : base(dataForm)
{
}
protected override void OnUpdateReadOnly(DataFormItem dataFormItem, Entry view)
{
view.IsReadOnly = dataFormItem.IsReadOnly;
}
}
dataForm.RegisterEditor("Text", new DataFormTextEditorExt(dataForm)); |