/// <summary>Sets the behaviors. /// </summary> /// <param name="window">The window.</param> /// <param name="chrome">The chrome.</param> public static void SetBehaviors(Window window, WindowBehaviors chrome) { if (window == null) { throw new ArgumentNullException("window"); } window.SetValue(BehaviorsProperty, chrome); }
/// <summary>Gets the behaviors. /// </summary> /// <param name="window">The window.</param> /// <returns></returns> private static WindowBehaviors GetInternalBehaviors(Window window) { if (window == null) { throw new ArgumentNullException("window"); } var behaviors = (WindowBehaviors)window.GetValue(BehaviorsProperty); if(behaviors == null) { behaviors = new WindowBehaviors { Window = window }; window.SetValue(BehaviorsProperty, behaviors); } else if(behaviors.Window != null) { behaviors.Window = window; window.SetValue(BehaviorsProperty, behaviors); } return behaviors; }