This project is read-only.

Patient Banner Allergies Collection Binding

Jul 14, 2009 at 10:34 PM
Edited Jul 14, 2009 at 10:46 PM

The PatientBanner's Allergies dependency property does not have a setter, and thus can not be binded to a view model's allergy collection when using MVVM patter.

To fix this a setter must be included as:

        /// <summary>
        /// Gets a collection of patient allergies.
        /// </summary>        
        /// <value>Allergy collection.</value>        
        [Category("Patient Details")]
        public AllergyCollection Allergies
                return (AllergyCollection)this.GetValue(AllergiesProperty);
            set { this.SetValue(AllergiesProperty, value); }
Once this is done, binding to the view model works, like so:


                          Width="750" Background="White" Canvas.ZIndex="99" FontFamily="Arial"
                          FamilyName="Evans" GivenName="Jonathan" Title="Mr" Gender="Male" DateOfBirth="12-02-2006" 
                          Identifier="606 172 4098" IdentifierType="NhsNumber" PreferredName="Jon"
                          Address1="98 Andover Place" County="Berkshire" Postcode="RG3 5AP" Town="Reading" 
                          HomePhoneNumber="(0118) 496 0337" MobilePhoneNumber="(07700) 900555" WorkPhoneNumber="(0118) 496 0338" 
                          Allergies="{Binding Allergies}">


I Kindly ask the team if this is the best way to go for this or if I'm missing something. Thanks



Jul 24, 2009 at 9:30 AM

Sorry for the delay. Yes this is the correct way to go. We did not add a setter as it violates an fxcop rule, but with binding the case for for get and set operations for collections is strong. I will add a work item to cover this for our next release.