Hi,
We are using XAF Persistent object and we want to change asterisk(*) instead of default image for required fields.I follow we below ticket but not able to get "DetailViewItem" in LayoutItemTemplateContainer object.
https://www.devexpress.com/Support/Center/Question/Details/Q296200
Code is below:
C#protected override Control CreateCaptionControl(LayoutItemTemplateContainer templateContainer)
{
Control result = null;
PropertyEditor editor = templateContainer.DetailViewItem.DetailViewItem as PropertyEditor;
if (editor != null)
{
if (editor.MemberInfo.FindAttribute<RuleRequiredFieldAttribute>() != null)
{
Table table = new Table();
table.Rows.Add(new TableRow());
table.Rows[0].Cells.Add(new TableCell());
table.Rows[0].Cells.Add(new TableCell());
Literal anchor = new Literal();
anchor.Text = string.Format("<span title='{0} Is Required' style='color:red'>*</span>", templateContainer.DetailViewItem.Caption);
table.Rows[0].Cells[0].Controls.Add(anchor);
Control baseControl = base.CreateCaptionControl(templateContainer);
table.Rows[0].Cells[1].Controls.Add(baseControl);
result = table;
}
}
if (result == null)
{
result = base.CreateCaptionControl(templateContainer);
}
return result;
}
bold part in above code is giving error.
Please help I tried other link but not working.