I have two usercontrols inheriting from UCBase (UCMain, and UCStartup).
The event is defined in base using…
CODE
public delegate void StepChangeHandler(object sender, StepChangeArgs e);
public event StepChangeHandler OnStepChanged;
The event is fired when the set accessor is called (in the base) for CurrentStep…
CODE
public virtual Enums.TPStep CurrentStep
{
get { return UCControlBase._CurrentStep; }
set {_CurrentStep = value;
_CompletedSteps |= ~value;
OnStepChanged(this, new StepChangeArgs(value)); } //*
}
In UCMain I’m subscribing to the event in the base…
CODE
base.OnStepChanged += new StepChangeHandler(StepChanged);
I also have an accessor to the base CurrentStep in UCMain,
CODE
public override ClassLibrary.Enums.TPStep CurrentStep
{ get { return base.CurrentStep; }
set { base.CurrentStep = value;}
}
What I’m trying to do is have the event get caught in UCMain whenever the currentstep is updated from any other control (all of which will decend from UCBase).
From UCStartup…
If I have a reference to UCMain in my UCStartup I can call the update from UCMain using…
CODE
main.CurrentStep =Enums.TPStep.FirstStep;
I don’t think I should have to call it through UMain for the event to be defined however, in the following case the “//*” above results in OnStepChanged being null
CODE
base.CurrentStep = ClassLibrary.Enums.TPStep.FirstStep
WHY? WHY WHY?Anybody?