Repository: unoplatform/uno
File: src/Uno.UI/UI/Xaml/Controls/Control/Control.cs (C#)

Code before:
			{
				// The baseValue hasn't been set inside PropertyDetails yet, so we need to make sure we're not
				// using the old weaker value when a new stronger value is being set
				localValue = baseValue;
			}

			return localValue;
		}


		#region Template DependencyProperty

		public ControlTemplate Template
		{
			get { return (ControlTemplate)GetValue(TemplateProperty); }
			set { SetValue(TemplateProperty, value); }
		}

		public static DependencyProperty TemplateProperty { get; } =
			DependencyProperty.Register(
				nameof(Template), 
				typeof(ControlTemplate), 
				typeof(Control), 
				new FrameworkPropertyMetadata(
					null, 
					FrameworkPropertyMetadataOptions.ValueDoesNotInheritDataContext | FrameworkPropertyMetadataOptions.AffectsMeasure,
					(s, e) => ((Control)s)?.OnTemplateChanged(e)));

		private void OnTemplateChanged(DependencyPropertyChangedEventArgs e)
		{
			_updateTemplate = true;
			SetUpdateControlTemplate();
		}

		#endregion

		/// <summary>
		/// Defines a method that will request the update of the control's template and request layout update.
		/// </summary>
		/// <param name="forceUpdate">If true, forces an update even if the control has no parent.</param>
		internal void SetUpdateControlTemplate(bool forceUpdate = false)
		{
			if (
				!FeatureConfiguration.Control.UseLegacyLazyApplyTemplate
				|| forceUpdate
				|| this.HasParent()
				|| CanCreateTemplateWithoutParent
			)
			{
				UpdateTemplate();
				this.InvalidateMeasure();

Review comment (suggestion):
I think that we should not change at large options like this ... I suspect that there are lot of case where the `InvalidateMeasure` was done in the property change callback. For instance this case you can see that the `INvalidateArrnge` is invoked here https://github.com/unoplatform/uno/pull/14253/files#diff-7e87918895f8b453fa65dab2ed76539d91c6f5c9f896ef2962aaadd7af2e121aR243 after some check, and noticeably a feature flag for that ...

Code after:
		{
			get { return (ControlTemplate)GetValue(TemplateProperty); }
			set { SetValue(TemplateProperty, value); }
		}

		public static DependencyProperty TemplateProperty { get; } =
			DependencyProperty.Register(
				nameof(Template),
				typeof(ControlTemplate),
				typeof(Control),
				new FrameworkPropertyMetadata(
					null,
					FrameworkPropertyMetadataOptions.ValueDoesNotInheritDataContext, // WinUI also has AffectsMeasure here, but we only do this conditionally in SetUpdateControlTemplate.
					(s, e) => ((Control)s)?.OnTemplateChanged(e)));

		private void OnTemplateChanged(DependencyPropertyChangedEventArgs e)
		{
			_updateTemplate = true;
			SetUpdateControlTemplate();
		}

		#endregion

		/// <summary>
		/// Defines a method that will request the update of the control's template and request layout update.
		/// </summary>
		/// <param name="forceUpdate">If true, forces an update even if the control has no parent.</param>
		internal void SetUpdateControlTemplate(bool forceUpdate = false)
		{
			if (
#if !UNO_HAS_ENHANCED_LIFECYCLE
				!FeatureConfiguration.Control.UseLegacyLazyApplyTemplate ||
#endif
				forceUpdate ||
				this.HasParent() ||
				CanCreateTemplateWithoutParent
			)
			{
				UpdateTemplate();
				this.InvalidateMeasure();
			}
		}

		/// <summary>
		/// Represents the single child that is the result of the control template application.
		/// </summary>
		internal View TemplatedRoot
		{
			get { return _templatedRoot; }
			set
			{