c# - Fire routed event when tooltip is changed -


i trying add routed event existed tooltip in control - bound simple get/set property.

binding in xaml:

 <style x:key="style" targettype="{x:type mycontrol}">       <setter property="tooltip" value="{binding name}" /> 

prop in mycontrol:

 public string name     {       get;       set;     } 

routed event in control class contains list of mycontrols (i suppose have wrote in right way)

public static readonly routedevent tooltipchangedevent = eventmanager.registerroutedevent("tooltipchanged", routingstrategy.bubble, typeof(routedpropertychangedeventhandler<string>), typeof(control));     public event routedpropertychangedeventhandler<string> tooltipchanged     {         add         {             addhandler(tooltipchangedevent, value);         }         remove         {             removehandler(tooltipchangedevent, value);         }     } 

the question how fire event when tooltip changed?

class mainviewmodel : frameworkelement, inotifypropertychanged {     private string _name;      public string name     {         { return _name; }         set         {             _name = value;             raiseevent(new routedeventargs(tooltipchangedevent));             onpropertychanged();         }     }      public static readonly routedevent tooltipchangedevent = eventmanager.registerroutedevent("tooltipchanged", routingstrategy.bubble, typeof(routedpropertychangedeventhandler<string>), typeof(control));     public event routedpropertychangedeventhandler<string> tooltipchanged     {         add         {             addhandler(tooltipchangedevent, value);         }         remove         {             removehandler(tooltipchangedevent, value);         }     }      public void onpropertychanged([callermembername] string propertyname = null)     {         if (propertychanged != null)             propertychanged(this, new propertychangedeventargs(propertyname));     }      public event propertychangedeventhandler propertychanged; } 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -