<commit_before>﻿namespace Fluent.Extensions
{
    using System.Windows;

    internal static class UIElementExtensions
    {
        public static void ForceMeasure(this UIElement element)
        {
            element.InvalidateMeasure();
            element.UpdateLayout();
        }

        public static void ForceMeasureAndArrange(this UIElement element)
        {
            element.InvalidateMeasure();
            element.InvalidateArrange();
            element.UpdateLayout();
        }
    }
}<commit_msg>Calling UpdateLayout on not already loaded elements causes weird side effects<commit_after>﻿namespace Fluent.Extensions
{
    using System.Windows;

    internal static class UIElementExtensions
    {
        public static void ForceMeasure(this FrameworkElement element)
        {
            element.InvalidateMeasure();

            // Calling UpdateLayout on not already loaded elements causes weird side effects
            if (element.IsLoaded)
            {
                element.UpdateLayout();
            }
        }

        public static void ForceMeasureAndArrange(this FrameworkElement element)
        {
            element.InvalidateMeasure();
            element.InvalidateArrange();

            // Calling UpdateLayout on not already loaded elements causes weird side effects
            if (element.IsLoaded)
            {
                element.UpdateLayout();
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.06415620641562064, 'fraction_numerical': 0.0, 'mean_word_length': 1.958762886597938, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3217895', 'n_tokens_mistral': 323, 'n_tokens_neox': 311, 'n_words': 86}