Skip to content

Commit e7de550

Browse files
committed
fix Media.Color
1 parent 4ea7631 commit e7de550

File tree

1 file changed

+9
-5
lines changed
  • src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media

1 file changed

+9
-5
lines changed

src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Color.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,8 @@ string IFormattable.ToString(string format, IFormatProvider provider)
265265
}
266266

267267
/// <summary>
268-
/// Creates a string representation of this object based on the format string
269-
/// and IFormatProvider passed in.
268+
/// Creates a string representation of this object based on the format string
269+
/// and IFormatProvider passed in.
270270
/// If the provider is null, the CurrentCulture is used.
271271
/// See the documentation for IFormattable for more information.
272272
/// </summary>
@@ -303,10 +303,14 @@ internal string ConvertToString(string format, IFormatProvider provider)
303303
String uriString = safeUnescapedUri.GetComponents(UriComponents.SerializationInfoString, UriFormat.UriEscaped);
304304

305305
var sb = new StringBuilder();
306-
sb.Append(provider, $"{Parsers.s_ContextColor}{uriString}{scRgbColor.a:R}");
306+
sb.Append(provider, $"{Parsers.s_ContextColor}{uriString} {scRgbColor.a:R}{separator}");
307307
for (int i= 0; i< nativeColorValue.Length; ++i )
308308
{
309-
sb.Append(provider, $"{separator}{nativeColorValue[i]:R}");
309+
sb.Append(provider, $"{nativeColorValue[i]:R}");
310+
if (i< nativeColorValue.GetLength(0)-1 )
311+
{
312+
sb.Append(provider, $"{separator}");
313+
}
310314
}
311315
return sb.ToString();
312316
}
@@ -413,7 +417,7 @@ public float[] GetNativeColorValues()
413417
{
414418
Color c1 = new Color();
415419
c1.context = color1.context;
416-
420+
417421
#pragma warning suppress 6506 // c1.context is obviously not null - both color1.context AND color2.context are not null
418422
c1.nativeColorValue = new float[c1.context.NumChannels];
419423
for (int i = 0; i < c1.nativeColorValue.GetLength(0); i++)

0 commit comments

Comments
 (0)