Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Propagator in C# - An Alternative to the Observer Design Pattern

, 14 Jul 2009 CPOL
Re-usable implementation of the Propagator Design Pattern in C#, a potentially more powerful alternative to the well-known Observer Design Pattern.
namespace PropagatorDemo
    partial class DemoForm
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
            if (disposing && (components != null))

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
            this.buttonReset = new System.Windows.Forms.Button();
            this.labelExample = new System.Windows.Forms.Label();
            this.colorControl = new PropagatorDemo.ColorControl();
            this.fontControl = new PropagatorDemo.FontControl();
            // buttonReset
            this.buttonReset.Location = new System.Drawing.Point(12, 9);
            this.buttonReset.Name = "buttonReset";
            this.buttonReset.Size = new System.Drawing.Size(88, 32);
            this.buttonReset.TabIndex = 3;
            this.buttonReset.Text = "Reset";
            this.buttonReset.UseVisualStyleBackColor = true;
            this.buttonReset.Click += new System.EventHandler(this.buttonReset_Click);
            // labelExample
            this.labelExample.AutoSize = true;
            this.labelExample.Location = new System.Drawing.Point(115, 19);
            this.labelExample.Name = "labelExample";
            this.labelExample.Size = new System.Drawing.Size(94, 13);
            this.labelExample.TabIndex = 4;
            this.labelExample.Text = "This is an example";
            // colorControl
            this.colorControl.Location = new System.Drawing.Point(296, 48);
            this.colorControl.Name = "colorControl";
            this.colorControl.Size = new System.Drawing.Size(287, 175);
            this.colorControl.TabIndex = 2;
            // fontControl
            this.fontControl.AutoSize = true;
            this.fontControl.Location = new System.Drawing.Point(3, 48);
            this.fontControl.Name = "fontControl";
            this.fontControl.Size = new System.Drawing.Size(287, 175);
            this.fontControl.TabIndex = 0;
            // DemoForm
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(586, 225);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.Name = "DemoForm";
            this.Text = "Propagator Demo";



        private FontControl fontControl;
        private ColorControl colorControl;
        private System.Windows.Forms.Button buttonReset;
        private System.Windows.Forms.Label labelExample;

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Martijn Boeker
Software Developer (Senior) Phi International
Canada Canada
Grew up in Amsterdam, now living in downtown Vancouver. There are definitely more mountains here.

My first internship was with the first company in the Netherlands to teach C++ ( During this internship I got to know Object Oriented Design, which kept my interest until this day. In the mean time, I have worked for different companies in the Netherlands and Canada. I have done most of my recent work in C#, developing Database/Web/Desktop applications.

I am currently working as a freelance Software Developer for PHI International in Amsterdam.

The CodeProject rocks!

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.150331.1 | Last Updated 14 Jul 2009
Article Copyright 2009 by Martijn Boeker
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid