Hi
I want to show value of an unbound field based on a condition from my view model. Please see attached sample where "ShowFullAddress" is a ViewModel property and my AddressConverter needs to set values based on values defined by multi binding.
Hello Abbas,
Thank you for contacting Infragistics!I took a look at your sample and the trouble you are running into results from your RelativeSources. The UnboundField binding has access to the current record and the visual state objects regarding the CellDataPresenter; but it does not have access to the other elements in the page. This makes binding for the Address1 and Address2 items simple, you just need <Binding Path="Address1" /> and <Binding Path="Address2" />.
However, the ShowFullAddress property in your MainViewModel presents a bit of a problem because it is not within the scope of the record. This can be solved in one of the following methods:
In the sample I've attached, I simply added the MainViewModel as a StaticResource.
Sincerely,JonInfragistics, Inc.http://es.infragistics.com/help
Hi Jon
Thank you very much for detailed explanation, it really helped. Is it possible if you could write a snippet for retemplating the CellDataPresenter option too? In my scenario I have to do retemplating and sorting stopped working.
Looking forward.
I am happy to help. I have attached a sample with the retemplated CellDataPresenter. I have included comments in the sample to help point to important parts of the code. We include the igWindows namespace for the template elements, we target the CellDataPresenter Template property, and then we put a TextBlock that gets placed above our ContentPresenter with our Multibinding Converter in it.
Because we are now working with a different context, we are able to reference the ShowFullAddress property in our XamDataGrid DataContext, as well as the Address 1 and 2 in our DataItem.
Let me know if you have any questions.
Thank you very much Jon, it is very helpful to follow it with your comments. Much appreciated.