Dan, Func<T, TProperty> selector , selector , T TProperty. , , BindElements , , ,
string CreatePersonElement(IPerson person) {
return string.Format("{0} {1}", person.FirstName, person.LastName);
}
TProperty string T IPerson. BindElements
BindElements(myPersonCollection,CreatePersonElement);
myPersonCollection , List<T>. foreach
foreach (T item in dataObjects) {
var property = selector(item);
InlineUIContainer uiContainer = this.CreateElementContainer(property)
para.Inlines.Add(uiContainer);
}
property TProperty, CreatePersonElement string. a string , , CreateElementContainer .
You will then have one of these methods to go into the second parameter for BindElementsfor each type that you want to support (i.e. ICustomer, IOrder).
source
share