Browse Source
Share Avalonia.Controls with Avalonia.Controls.Documents (#19191)
* Share internals with Avalonia.Constrols.Documents
* Inlines might be null
* Use IAddChild<T>
---------
Co-authored-by: Julien Lebosquain <julien@lebosquain.net>
pull/19225/head
Benedikt Stebner
7 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
17 additions and
1 deletions
-
build/ExternalConsumers.props
-
src/Avalonia.Controls/Documents/Span.cs
|
|
@ -30,5 +30,6 @@ |
|
|
<InternalsVisibleTo Include="UIAutomationProvider, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9" /> |
|
|
<InternalsVisibleTo Include="UIAutomationProvider, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9" /> |
|
|
<InternalsVisibleTo Include="PresentationCore, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9" /> |
|
|
<InternalsVisibleTo Include="PresentationCore, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9" /> |
|
|
<InternalsVisibleTo Include="Avalonia.ForTestingOnly, PublicKey=$(AvaloniaPublicKey)" /> |
|
|
<InternalsVisibleTo Include="Avalonia.ForTestingOnly, PublicKey=$(AvaloniaPublicKey)" /> |
|
|
|
|
|
<InternalsVisibleTo Include="Avalonia.Controls.Documents, PublicKey=$(AvaloniaPublicKey)" /> |
|
|
</ItemGroup> |
|
|
</ItemGroup> |
|
|
</Project> |
|
|
</Project> |
|
|
|
|
|
@ -9,7 +9,7 @@ namespace Avalonia.Controls.Documents |
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Span element used for grouping other Inline elements.
|
|
|
/// Span element used for grouping other Inline elements.
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
public class Span : Inline |
|
|
public class Span : Inline, IAddChild<Inline>, IAddChild<Control>, IAddChild<string> |
|
|
{ |
|
|
{ |
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Defines the <see cref="Inlines"/> property.
|
|
|
/// Defines the <see cref="Inlines"/> property.
|
|
|
@ -96,5 +96,20 @@ namespace Avalonia.Controls.Documents |
|
|
void OnInlinesInvalidated(object? sender, EventArgs e) |
|
|
void OnInlinesInvalidated(object? sender, EventArgs e) |
|
|
=> InlineHost?.Invalidate(); |
|
|
=> InlineHost?.Invalidate(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void IAddChild<Inline>.AddChild(Inline inline) |
|
|
|
|
|
{ |
|
|
|
|
|
Inlines?.Add(inline); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void IAddChild<Control>.AddChild(Control child) |
|
|
|
|
|
{ |
|
|
|
|
|
Inlines?.Add(new InlineUIContainer(child)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void IAddChild<string>.AddChild(string text) |
|
|
|
|
|
{ |
|
|
|
|
|
Inlines?.Add(new Run(text)); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|