Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1925
Multibinding an unbound field based on condition of viewmodel
posted

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.

ConditionalFieldsInObject.zip
Parents
No Data
Reply
  • 570
    posted

    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:

    • Add a Static or Dynamic Resource for the MainViewModel to access this path.
    • Add the ShowFullAddress property to each record in the ObservableCollection.
    • Add a reference to the parent MainViewModel to the records in the ObservableCollection
    • Retemplate the CellDataPresenter to include your property.

    In the sample I've attached, I simply added the MainViewModel as a StaticResource.

    Sincerely,
    Jon
    Infragistics, Inc.
    http://ko.infragistics.com/help

    ConditionalFieldsInObject.zip
Children