/// <summary> /// PlacementRectangle Property changed callback, pass the value through to the buttons context menu /// </summary> private static void OnPlacementRectangleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { SplitButton s = d as SplitButton; if (s == null) { return; } s.EnsureContextMenuIsValid(); s.ContextMenu.PlacementRectangle = (Rect)e.NewValue; }
/// <summary> /// VerticalOffset Property changed callback, pass the value through to the buttons context menu /// </summary> private static void OnVerticalOffsetChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { SplitButton s = d as SplitButton; if (s == null) { return; } s.EnsureContextMenuIsValid(); s.ContextMenu.VerticalOffset = (double)e.NewValue; }
/* * DependencyPropertyChanged callbacks * */ private static void OnIsContextMenuOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { SplitButton s = (SplitButton)d; s.EnsureContextMenuIsValid(); if (!s.ContextMenu.HasItems) { return; } bool value = (bool)e.NewValue; if (value && !s.ContextMenu.IsOpen) { s.ContextMenu.IsOpen = true; } else if (!value && s.ContextMenu.IsOpen) { s.ContextMenu.IsOpen = false; } }