Control binding to nested properties in DataRepeater

0
0

Hi guys,

A very convenient feature of binding is that one can bind to nested properties. For example, consider the following:
public class Person
{
public string LastName {get; set;}
}
public class Employee
{
public Person Person {get; set;}
}
Then one can bind a textbox’s “Text” property like
txtLast.DataBindings.Add(new Binding(“Text”, employeeObject, “Person.LastName”));

And all this works very nicely, without having to “flatten” the object, i.e. add a new property to Employee like PersonLastName = Person.LastName.

However, this seems to not be the case if the textbox is in the ItemTemplate of a DataRepeater. Is this intentional, a neglected feature or a bug? In any case, it would be a nice enhancement.

I am attaching a project showing this behaviour.

Best,
Alex

  • You must to post comments
0
0

Thank you, Luca.
A

  • You must to post comments
0
0

It’s a known limitation when binding to a child record, same for DataGridViewColumn. Child elements don’t use the Binding class, they use the BindingMember (DataMember, etc) which supports binding to the member. The nested properties are supported for child data sources and top level binding.

We have an issue logged for this as a possible future enhancement.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.