/// <inheritdoc/> void ISerializationCallbackReceiver.OnBeforeSerialize() { // Backward compatibility at runtime in case some custom properties have been added in code after first serialization ThemeDefinition defaultDefinition = GetDefaultThemeDefinition(ThemeType).Value; if (defaultDefinition.CustomProperties.Count > CustomProperties.Count) { foreach (ThemeProperty prop in defaultDefinition.CustomProperties) { if (!CustomProperties.Exists(p => p.Name == prop.Name)) { CustomProperties.Add(new ThemeProperty() { Name = prop.Name, Tooltip = prop.Tooltip, Type = prop.Type, Value = prop.Value, }); } } } }