tags:

views:

59

answers:

1

[Sorry for the title, I really didn't find a good one, if anyone has an idea, please edit, thanks!]

Hello,

I'm looking for a pattern / best practice for the following situation (just an example).

Imagine an editor for rectangles (just e.g. adding, resizing, removing rectangles). All rectangles shall have the same color, however this general color shall be changeable. The rectangle color shall be set using the editor class, something like

editor.RectangleColor = Red

The color shall however not be changeable directly on the rectangles, because this would probably allow an individual color for every rectangle.

What's the best way to realize this? Thanks in advance for any hint!

+1  A: 

I think Observer pattern should help in this situation.

this. __curious_geek
Thank you very much, that looks fine! For the record: In C#, Events are an alternative for this pattern / similar to it.
stefan.at.wpf