Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>i would say a very simple and efficient way to solve this issue would be to use the INotifyPropertyChanged interface in order to use the Observer-Pattern.</p> <p>Let the container that fires the initial event be the observable part and let the two others observe it. So whenever the observable container does something (e.g. fires a click-event) the others will get informed and can react accordingly.</p> <p>Once your OutsideContainer class is observable, do these two steps:</p> <ol> <li><p>In the OutsideButton class fire the PropertyChanged event in appropirate place (e.g. where the "super"-click happens.</p></li> <li><p>In the ImageFade and ButtonFace class chatch the PropertyChanged event and do something (e.g. let them fire their own click-event).</p></li> </ol> <p>Try the following:</p> <p>In the code-behind file OutsideBoard.cs implement the INotifyPropertyChanged interface in order to make it observable:</p> <pre><code>class OutsideBoard : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; private void FirePropertyChanged (string property) { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(property)); } } // the click- EventHandler of your UserControl public event Click_EventHandler (object sender, RoutedEventArgs e) { // your clicking code of your UserControl FirePropertyChanged("SuperClick"); } // rest of the code inhere ... } </code></pre> <p>Now every class that wants to observe the OutsideBorder class has to implement an EventHandler on that class:</p> <p>Write something like the following in your ButtonFade and ImageFade class:</p> <pre><code>outsideBorder.PropertyChanged += PropertyEventChangeHandler(MyClickHandling); public void MyClickHandling (object sender, PropertyChangeEventArgs e) { // do something } </code></pre> <p>So whenever the OutsideBoard class fires the PropertyChanged event, all observers will get notified by calling their MyClickHandling - method.</p> <p>Hope that will help you.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload