/// <summary> /// Waits for the next layout update event. /// </summary> /// <param name="frameworkElement">The framework element.</param> /// <returns></returns> public static async Task WaitForLayoutUpdateAsync(this FrameworkElement frameworkElement) { await EventAsync.FromEvent <object>( eh => frameworkElement.LayoutUpdated += eh, eh => frameworkElement.LayoutUpdated -= eh); }