Extended Patient Banner Silverlight SubSectionThreeContent

Feb 19, 2009 at 5:57 PM
Can someone point me to how you can implement the SubSectionThreeContent in the Silverlight?  I understand how it works as an ASP.NET application but not as Silverlight.
Coordinator
Feb 24, 2009 at 4:46 PM

This is a bug in the patient banner that we have fixed in our solution, and will be deployed with the next release. You can fix this yourself by doing the following to the code. Sorry of the inconvenience.
-Stuart

Changes to be done to PatientBanner.cs in order to be able to add content to subsection three and subsection four.

 

Note: PatientBanner.cs file is located under “Microsoft.Cui.Controls\PatientBanner” folder

 

1.       Add the following code at the end of the class

/// <summary>

        /// Loads the content for subsection three.

        /// </summary>

        private void LoadSubsectionThreeContent()

        {

            Border subsectionThreePanel = this.GetTemplateChild("SubsectionThreeContentPanel") as Border;

            if (subsectionThreePanel != null)

            {

                if (this.SubSectionThreeContent != null)

                {

                    UIElement element = this.SubSectionThreeContent as UIElement;

                    if (element != null)

                    {

                        subsectionThreePanel.Child = element;

                    }

                    else

                    {

                        TextBlock elementText = new TextBlock();

                        elementText.Text = this.SubSectionThreeContent.ToString();

                        subsectionThreePanel.Child = elementText;

                    }

                }

                else

                {

                    subsectionThreePanel.Child = null;

                }

            }

        }

 

        /// <summary>

        /// Loads the content for subsection four.

        /// </summary>

        private void LoadSubsectionFourContent()

        {

            Border subsectionFourPanel = this.GetTemplateChild("SubsectionFourContentPanel") as Border;

            if (subsectionFourPanel != null)

            {

                if (this.SubSectionFourContent != null)

                {

                    UIElement element = this.SubSectionFourContent as UIElement;

                    if (element != null)

                    {

                        subsectionFourPanel.Child = element;

                    }

                    else

                    {

                        TextBlock elementText = new TextBlock();

                        elementText.Text = this.SubSectionFourContent.ToString();

                        subsectionFourPanel.Child = elementText;

                    }

                }

                else

                {

                    subsectionFourPanel.Child = null;

                }

            }

        }

 


2.       Modify the OnApplyTemplate method to invoke these functions. (Append the following code to the existing OnApplyTemplate method)

this.LoadSubsectionThreeContent();

this.LoadSubsectionFourContent();

 

3.       Replace the OnSubsectionContentChanged method to following

private static void OnSubSectionContentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)

        {

            if (e.OldValue != e.NewValue)

            {

                PatientBanner banner = d as PatientBanner;

                if (banner != null)

                {

                    if (e.Property == SubSectionThreeContentProperty)

                    {

                        banner.LoadSubsectionThreeContent();

                    }

                    else if (e.Property == SubSectionFourContentProperty)

                    {

                        banner.LoadSubsectionFourContent();

                    }

                }

            }

        }

 

4.       Replace the dependency properties SubSectionThreeContentProperty and SubSectionFourContentProperty to the following.

/// <summary>

        /// Identifies the <see cref="Microsoft.Cui.Controls.PatientBanner.SubSectionThreeContent"/> dependency property.

        /// </summary>

        public static readonly DependencyProperty SubSectionThreeContentProperty = DependencyProperty.Register(

            "SubSectionThreeContent",

            typeof(object),

            typeof(PatientBanner),

            new PropertyMetadata(new PropertyChangedCallback(OnSubSectionContentChanged)));

 

        /// <summary>

        /// Identifies the <see cref="Microsoft.Cui.Controls.PatientBanner.SubSectionFourContent"/> dependency property.

        /// </summary>

        public static readonly DependencyProperty SubSectionFourContentProperty = DependencyProperty.Register(

            "SubSectionFourContent",

            typeof(object),

            typeof(PatientBanner),

            new PropertyMetadata(new PropertyChangedCallback(OnSubSectionContentChanged))); 

 

Sep 18, 2009 at 9:10 PM
Edited Sep 18, 2009 at 9:25 PM

Hi

Using these properties in patient banner given belwo what we add shows up in the screen.

SubSectionFourTitle

="Considerations" SubSectionThreeTitle="Other Information" 

SubSectionFourContent="Content Four..... In This Zone" SubSectionThreeContent="Content Three...In This Zone"

But i want to place something again same like the contact details area, Naming it as Discharge Summary with 4 Rows in that section.  How can i do that.

with/without adding above code i can see the above 4 properties working fine.

So i want same contact template but with different values heaeder is Discharge Summary and Detials have 4 rows with 2 columsn.

should i create new dependency properties and stuff like that, new control as contactlabelcontrol.

Please let me know how to implement the same.

Thanks,

Suman