Results 1 to 2 of 2

Thread: Event not firing

Threaded View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2005
    Location
    Cebu
    Posts
    607

    Resolved 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.
    Last edited by nebulom; Jan 30th, 2007 at 08:59 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width