Hi all,
I have a problem binding a List<DateTime> to a DataPresenter.
When binding it with AutogenerateFields = true everything works fine, but I want to define the fields in XAML like that (this is created by the tip of Josh Smith [http://blogs.infragistics.com/blogs/josh_smith/archive/2008/10/03/how-to-avoid-typing-fieldlayout-xaml.aspx]:
<igDP:XamDataPresenter.FieldLayouts>
<igDP:FieldLayout>
</igDP:FieldLayout.Fields>
</igDP:FieldLayout>
The Grid is always empty, until I switch back to AutoGenerateFields = trueBinding is done in code while ThePlan.TheDates is a List<DateTime>:
this
.dpThePlan.DataSource = ThePlan.TheDates;
Any ideas on this one?Have a great day and best regardsAndy
Hello Andy,
This is because the Fields use the name of the public properties to bind to the underlying data. As DataTime (and int, string, bool, etc.) are atomic types they do not have names and that is why "Value" is used. If you are binding to List<DateTime> then you would always have only one FieldLayout and only on Field, so you could leave the XamDataGrid create this and set the Field's properties through the FieldSettings/ FieldLayoutSettings objects. If that is not an option, you can try with UnboundField and setting its BindingPath property, which should be able to bind to "Value".
...and again, thanks a lot Alex ;)I switched to fieldsettings and everything is fine.
best regardsAndy