Skip to content

Instantly share code, notes, and snippets.

@SmashBrando
Created August 13, 2021 15:44
Show Gist options
  • Save SmashBrando/d4865d57abd0dfdbfd32ccff7a97bc93 to your computer and use it in GitHub Desktop.
Save SmashBrando/d4865d57abd0dfdbfd32ccff7a97bc93 to your computer and use it in GitHub Desktop.
// This event uses the bubbling routing strategy
public static readonly RoutedEvent CheckedEvent = EventManager.RegisterRoutedEvent(
"Checked", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(TreeView));
public static void AddCheckedHandler(DependencyObject d, RoutedEventHandler handler)
{
UIElement uie = d as UIElement;
if (uie != null)
{
uie.AddHandler(CheckedTreeViewItem.CheckedEvent, handler);
}
}
public static void RemoveCheckedHandler(DependencyObject d, RoutedEventHandler handler)
{
UIElement uie = d as UIElement;
if (uie != null)
{
uie.RemoveHandler(CheckedTreeViewItem.CheckedEvent, handler);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment