Hi There,
How can I bind field value to the data in my business object, and do it in code-behind?
Cheers
Jonathan
Hello Robson,
Thank you for your post.
I have been looking into it and I am not sure that I understand correctly what you are trying to achieve. If I understand correctly your requirement the following forum thread could be of help to you, please take a look at the following link:
http://es.infragistics.com/community/forums/t/96654.aspx
where similar functionality was achieved.
Please look at the sample application from this thread and if it doesn’t cover your expectations feel free to modify it, so you reproduce the described behavior and send it back to me for further investigation or provide me with more details about your requirements in order to be able to investigate it further for you and support you.
Looking forward to hearing from you.
I think the link you posted is the link to this article?
If we have the following class...
class A
{
B Child {get; set;}
}
class B
int Value {get; set;}
in code how can I bind an infragistics Field to the Value field of class B, so the binding path would be Child.Value I think.
Thank you for your feedback.
I have been looking into your requirement. That I can suggest is to handle FieldLayoutInitilized event of XamDataGrid. In the event handler you can create Fields and add them to the Fields collection of XamDataGrid. In order to be able to bind the Child object you can use UseAlternateBinding mode of BindingType property of Field class. By AlternateBinding property you can navigate the direct binding path. Please take a look at the following link from our online documentation:
http://help.infragistics.com/doc/WPF/2015.1/CLR4.0/?page=xamDataPresenter_Add_Unbound_Fields_to_a_DataPresenter_Control.html
http://help.infragistics.com/doc/WPF/2015.1/CLR4.0/?page=InfragisticsWPF4.DataPresenter.v15.1~Infragistics.Windows.DataPresenter.BindingType.html
Where you can find more details about this mode and how can Configuring Unbound Field. I created short sample application based on your scenario to show you how you can implement this approach and achieve the functionality that you are looking for. Please let me know if I am missing something about your scenario and let me know if this sample application does not cover your expectations.
If you require any further assistance, please do not hesitate to ask.
Is this available in v14.1 please?
I have been looking into your requirement. Yes it is available in version 14.1. You can take a look at the following link from our online documentation:
http://help.infragistics.com/Help/Doc/WPF/2014.2/CLR4.0/html/xamDataPresenter_Add_Unbound_Fields_to_a_DataPresenter_Control.html#_Ref391653270
You just have to change Field to UnboundField and set it`s BindingPath property to new PropertyPath instead of BindingType. I modified the last sample application to show you how you can implement this approach with version 14.1.
Please let me know if you require any further assistance on the matter.
Yea, we are using UnboundField, but the filtering and grouping performance is horrendous with UnboundFields, also when using UnboundField you cannot utilize...
It feels like a bug that UnboundFields perform so poorly. Is there a solution for v14.1 or can we raise a bug please?
Note once we move to regular fields by hacking our domain model so that there are not binding paths and using the above xamdatagrid settings, performance becomes quite good, however the hacks we put in our domain model are no real solution, we just tried it to see what difference removing the UnboundFields would make.
UnboundField seems to reevaluate the binding everytime we group or sort etc, regardless of us setting the binding mode to OneTime. Performance is so bad.
Hello,
I am just checking if you require any further assistance on the matter.
I have been looking into your issue and after contacting with our development team, what I can suggest is to try to set the BindingRetaintionMode property of UnboundField to Retain, so you will be able to reuse the unbound`s field value and won`t be a need to re-creating the binding object. For more details about BindingRetaintionMode property you can take a look at the following links from our online documentation:
http://help.infragistics.com/Help/Doc/WPF/2014.1/CLR4.0/html/InfragisticsWPF4.DataPresenter.v14.1~Infragistics.Windows.DataPresenter.UnboundField~BindingRetentionMode.html
http://help.infragistics.com/Help/Doc/WPF/2015.1/CLR4.0/html/InfragisticsWPF4.DataPresenter.v15.1~Infragistics.Windows.DataPresenter.BindingRetentionMode.html
Would you please try this approach and let me know if you require any further assistance on the matter.
Yes. We dont utilize the CollectionView attributes with UnboundFields as they don't work. I would be interested in why the UnboundField performance is so shockingly bad though for sorting, grouping and filtering?
I am just checking if there is anything else I can do for you.
I have been looking into it. The behavior that you have described about filtering is expected, when using UnboundFields with FilterEvaluationMode set to UseCollectionView. Since the ICollectionView filters itself and provides a subset of data items to the data presenter, the data presenter discards the filtered out data items’ DataRecord objects. Therefore, selected or activated records toggle their selected or activated state following the removal of the filtering criteria when the data grid refreshes. You can only perform filtering on bound data fields.
Please take a look at the following link from our online documentation:
http://help.infragistics.com/Help/Doc/WPF/2014.1/CLR4.0/html/xamDataGrid_External_Filtering.html
where you can find more details about External Filtering in XamDataGrid. Also what I can suggest is to take a look at the following blog post, it can be of help to you to improve the performance:
http://es.infragistics.com/community/blogs/damyan_petev/archive/2012/05/07/external-sorting-grouping-filtering-aggregation-with-the-wpf-xamdatagrid.aspx
Please let me know if you need any further assistance on the matter.