I have created one class like.......
public class UIElementClass:UIElement
{
public XmlLanguage Language
{
get { return (XmlLanguage)GetValue(LanguageProperty); }
set { SetValue(LanguageProperty, value); }
}
public static readonly DependencyProperty LanguageProperty =
DependencyProperty.Register("Language", typeof(XmlLanguage),
typeof(UIElementClass), new UIPropertyMetadata(LanguagePropertyChangedCallback));
protected static void LanguagePropertyChangedCallback(DependencyObject sender, DependencyPropertyChangedEventArgs e)
{
(sender as UIElement).RaiseEvent(new RoutedEventArgs(LanguageChangedEvent));
}
public static readonly RoutedEvent LanguageChangedEvent = EventManager.RegisterRoutedEvent(
"LanguageChanged", RoutingStrategy.Tunnel, typeof(RoutedEventHandler), typeof(UIElementClass));
public event RoutedEventHandler LanguageChanged
{
add { AddHandler(LanguageChangedEvent, value); }
remove { RemoveHandler(LanguageChangedEvent, value); }
}
}
In this class one LanguageChanged event is there.That event i have call like....
_languageUIElement.LanguageChanged += new RoutedEventHandler(delegate(object sender, RoutedEventArgs e)
{
});
This event not work more then 5 times.Only 5 times give the output.That event call on button click.
I am using wpf with c#.net.