/// <summary> /// Sets a value of an Avalonia Object. Unlike the /// direct setters, this method is thread-safe. /// </summary> /// <param name="this">Avalonia Object to set the property of.</param> /// <param name="propertyName">Name of the property to set.</param> /// <param name="value">Value to set.</param> /// <typeparam name="T">Type of the value set.</typeparam> public static void Set <T>(this AvaloniaObject @this, string propertyName, T value) { @this.Run(() => { @this.GetType()?.GetProperty(propertyName)?.SetValue(@this, value); }); }