private SetWindowChromeWorker ( |
||
window | ||
chrome | ||
리턴 | void |
private static void _OnChromeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { // The different design tools handle drawing outside their custom window objects differently. // Rather than try to support this concept in the design surface let the designer draw its own // chrome anyways. // There's certainly room for improvement here. if (System.ComponentModel.DesignerProperties.GetIsInDesignMode(d)) { return; } var window = (Window)d; var newChrome = (WindowChrome)e.NewValue; Assert.IsNotNull(window); // Update the ChromeWorker with this new object. // If there isn't currently a worker associated with the Window then assign a new one. // There can be a many:1 relationship of Window to WindowChrome objects, but a 1:1 for a Window and a WindowChromeWorker. WindowChromeWorker chromeWorker = WindowChromeWorker.GetWindowChromeWorker(window); if (chromeWorker == null) { chromeWorker = new WindowChromeWorker(); WindowChromeWorker.SetWindowChromeWorker(window, chromeWorker); } chromeWorker.SetWindowChrome(newChrome); }
private static void _OnChromeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (!DesignerProperties.GetIsInDesignMode(d)) { Window window = (Window)d; WindowChrome newValue = (WindowChrome)e.NewValue; WindowChromeWorker windowChromeWorker = WindowChromeWorker.GetWindowChromeWorker(window); if (windowChromeWorker == null) { windowChromeWorker = new WindowChromeWorker(); WindowChromeWorker.SetWindowChromeWorker(window, windowChromeWorker); } windowChromeWorker.SetWindowChrome(newValue); } }