Browse Source
Merge pull request #6176 from pr8x/more-to-strin-devtools
Adding more ToString() overloads to improve DevTools
pull/6187/head
Max Katz
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
66 additions and
3 deletions
-
src/Avalonia.Controls/RowDefinitions.cs
-
src/Avalonia.Visuals/Media/BoxShadow.cs
-
src/Avalonia.Visuals/Media/BoxShadows.cs
|
|
|
@ -1,5 +1,4 @@ |
|
|
|
using System.Linq; |
|
|
|
using Avalonia.Collections; |
|
|
|
|
|
|
|
namespace Avalonia.Controls |
|
|
|
{ |
|
|
|
@ -25,6 +24,11 @@ namespace Avalonia.Controls |
|
|
|
AddRange(GridLength.ParseLengths(s).Select(x => new RowDefinition(x))); |
|
|
|
} |
|
|
|
|
|
|
|
public override string ToString() |
|
|
|
{ |
|
|
|
return string.Join(",", this.Select(x => x.Height)); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Parses a string representation of row definitions collection.
|
|
|
|
/// </summary>
|
|
|
|
@ -32,4 +36,4 @@ namespace Avalonia.Controls |
|
|
|
/// <returns>The <see cref="RowDefinitions"/>.</returns>
|
|
|
|
public static RowDefinitions Parse(string s) => new RowDefinitions(s); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -1,5 +1,6 @@ |
|
|
|
using System; |
|
|
|
using System.Globalization; |
|
|
|
using System.Text; |
|
|
|
using Avalonia.Animation.Animators; |
|
|
|
using Avalonia.Utilities; |
|
|
|
|
|
|
|
@ -75,6 +76,46 @@ namespace Avalonia.Media |
|
|
|
return rv; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public override string ToString() |
|
|
|
{ |
|
|
|
var sb = new StringBuilder(); |
|
|
|
|
|
|
|
if (IsEmpty) |
|
|
|
{ |
|
|
|
return "none"; |
|
|
|
} |
|
|
|
|
|
|
|
if (IsInset) |
|
|
|
{ |
|
|
|
sb.Append("inset"); |
|
|
|
} |
|
|
|
|
|
|
|
if (OffsetX != 0.0) |
|
|
|
{ |
|
|
|
sb.AppendFormat(" {0}", OffsetX.ToString()); |
|
|
|
} |
|
|
|
|
|
|
|
if (OffsetY != 0.0) |
|
|
|
{ |
|
|
|
sb.AppendFormat(" {0}", OffsetY.ToString()); |
|
|
|
} |
|
|
|
|
|
|
|
if (Blur != 0.0) |
|
|
|
{ |
|
|
|
sb.AppendFormat(" {0}", Blur.ToString()); |
|
|
|
} |
|
|
|
|
|
|
|
if (Spread != 0.0) |
|
|
|
{ |
|
|
|
sb.AppendFormat(" {0}", Spread.ToString()); |
|
|
|
} |
|
|
|
|
|
|
|
sb.AppendFormat(" {0}", Color.ToString()); |
|
|
|
|
|
|
|
return sb.ToString(); |
|
|
|
} |
|
|
|
|
|
|
|
public static unsafe BoxShadow Parse(string s) |
|
|
|
{ |
|
|
|
if(s == null) |
|
|
|
|
|
|
|
@ -1,6 +1,6 @@ |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.ComponentModel; |
|
|
|
using System.Text; |
|
|
|
using Avalonia.Animation.Animators; |
|
|
|
|
|
|
|
namespace Avalonia.Media |
|
|
|
@ -43,6 +43,24 @@ namespace Avalonia.Media |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public override string ToString() |
|
|
|
{ |
|
|
|
var sb = new StringBuilder(); |
|
|
|
|
|
|
|
if (Count == 0) |
|
|
|
{ |
|
|
|
return "none"; |
|
|
|
} |
|
|
|
|
|
|
|
foreach (var boxShadow in this) |
|
|
|
{ |
|
|
|
sb.AppendFormat("{0} ", boxShadow.ToString()); |
|
|
|
} |
|
|
|
|
|
|
|
return sb.ToString(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
[EditorBrowsable(EditorBrowsableState.Never)] |
|
|
|
public struct BoxShadowsEnumerator |
|
|
|
{ |
|
|
|
|