Search code examples
c#collectionsformatdevexpressxaf

DevExpress: How to use ObjectFormatter.Format for collections


I have dynamically created collection elements. I try to do something like this

String format = "{0:Document.Contragent.BDContragentInfo[Field.Caption == 'Email'].Single(Value)}";
String generatedNumber = ObjectFormatter.Format(format, formatObjectHelper); 

There's an error, that there's no such field like 'Document.Contragent.BDContragentInfo[Field.Caption == 'Email'].Single(Value) '

But it works for CriteriaOperator. Is there a way to solve this problem?

UPD: As a temporary solution used ObjectSpace.GetEvaluator(...).Evaluate() method to evaluate object by criteria


Solution

  • I got the answer from DE. The answer is I can't do this. So if you have such problem, use either my solution in UPD section or use the DE answer solution https://www.devexpress.com/support/center/Question/Details/T346980