public void UpdateWidgetViewBindings(DesktopPanelBase oldDesktopPanelBase, DesktopPanelBase newDesktopPanelBase) { var childs = WPFHelper.FindChilds <IconButton>(this); foreach (var c in childs) { if (c.ClickHandlerCommandParameter is object[] t && t.Length == 2 && t[0] == oldDesktopPanelBase) { t[0] = newDesktopPanelBase; } } }
public static void SetIsEnabledDraggableDescendants(DependencyObject root, Type descendantType, bool isEnabled) { #if false && dbg DesktopPanelTool.Lib.Debug.WriteLine($"set isEnable {descendantType.Name} isEnabled={isEnabled}"); #endif if (descendantType != null) { var draggableElements = WPFHelper.FindChilds(descendantType, root); foreach (var de in draggableElements) { DraggableFrameworkElementBehavior.SetIsEnabled(isEnabled, (FrameworkElement)de); } } }
private void AssociatedObject_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (AssociatedObject.IsVisible) { var menuItems = WPFHelper.FindChilds <MenuItem>(AssociatedObject, true); foreach (var menuItem in menuItems) { if (menuItem.IsSubmenuOpen) { menuItem.IsSubmenuOpen = false; } } } }
private void AssociatedObject_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) { if (!AssociatedObject.IsVisible) { var menuItems = WPFHelper.FindChilds <MenuItem>(AssociatedObject, true); foreach (var menuItem in menuItems) { if (menuItem.IsSubmenuOpen) { menuItem.IsSubmenuOpen = false; } } } }