-
Event not firing
I'm not quite sure what I am missing, anyway here's what I need. I have a ViewContent class that has TitleName property. ViewContent.cs
Code:
public string TitleName {
get {
return titleName;
}
set {
titleName = value;
OnTitleNameChanged(EventArgs.Empty);
}
}
and a public event EventHandler TitleNameChanged; and
Code:
protected virtual void OnTitleNameChanged(EventArgs e)
{
if (TitleNameChanged != null) {
TitleNameChanged(this, e);
}
}
WorkbenchWindow.cs Calling the ViewContent at another class, I have this
Code:
this.content = content;
content.Control.Dock = DockStyle.Fill;
content.WorkbenchWindow = this;
content.TitleNameChanged += new EventHandler(OnTitleNameChanged);
and the OnTitleNameChanged
Code:
void OnTitleNameChanged(object sender, EventArgs e)
{
if (content == null) {
return;
}
this.Text = content.TitleName;
}
Now I have subclassed the ViewContent and call it SomeView.cs and on the blank constructor I have
Code:
public SomeView() : base("New View")
{
}
But the thing is that the WorkbenchWindow's OnTitleNameChanged is not fired. Would appreciate any help finding why I don't get my event thingy work. :(
-
Re: Event not firing
Nevermind, it does find the Event null for the first time. Next call to TitleName will fire the event.