Skip to content

Commit 18ef903

Browse files
authored
Make internal types used by MAUI Toolkit public (#29443)
* Make internal types used by MAUI Toolkit public * Update AssemblyInfo.cs
1 parent 368000a commit 18ef903

13 files changed

+265
-47
lines changed
Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1-
#nullable disable
2-
namespace Microsoft.Maui.Controls
1+
namespace Microsoft.Maui.Controls;
2+
3+
/// <summary>
4+
/// Defines properties for elements that can have rounded corners.
5+
/// </summary>
6+
/// <remarks>
7+
/// This interface is implemented by UI elements that support corner radius customization,
8+
/// allowing for consistent styling of corners across different controls.
9+
/// </remarks>
10+
public interface ICornerElement
311
{
4-
interface ICornerElement
5-
{
6-
//note to implementor: implement this property publicly
7-
CornerRadius CornerRadius { get; }
8-
}
9-
}
12+
/// <summary>
13+
/// Gets the radius for the corners of the element.
14+
/// </summary>
15+
/// <value>A <see cref="CornerRadius"/> value that specifies the radius for each corner of the element. The default value depends on the implementing control.</value>
16+
/// <remarks>Implementors should implement this property publicly.</remarks>
17+
CornerRadius CornerRadius { get; }
18+
}
Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
1-
#nullable disable
2-
using System.ComponentModel;
1+
namespace Microsoft.Maui.Controls;
32

4-
namespace Microsoft.Maui.Controls.Internals
3+
/// <summary>
4+
/// Defines properties and methods for elements that support line height customization.
5+
/// </summary>
6+
/// <remarks>
7+
/// This interface is implemented by UI elements that need to control the spacing between lines of text,
8+
/// providing consistent line height behavior across different text-based controls.
9+
/// </remarks>
10+
public interface ILineHeightElement
511
{
6-
[EditorBrowsable(EditorBrowsableState.Never)]
7-
interface ILineHeightElement
8-
{
9-
double LineHeight { get; }
12+
/// <summary>
13+
/// Gets the line height for text displayed by this element.
14+
/// </summary>
15+
/// <value>A multiplier that determines the spacing between lines of text. A value of 1.0 represents standard line height.</value>
16+
double LineHeight { get; }
1017

11-
void OnLineHeightChanged(double oldValue, double newValue);
12-
}
13-
}
18+
/// <summary>
19+
/// Called when the <see cref="LineHeight"/> property changes.
20+
/// </summary>
21+
/// <param name="oldValue">The old value of the property.</param>
22+
/// <param name="newValue">The new value of the property.</param>
23+
/// <remarks>Implementors should implement this method explicitly.</remarks>
24+
void OnLineHeightChanged(double oldValue, double newValue);
25+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#nullable disable
2+
using System;
3+
using System.ComponentModel;
4+
5+
namespace Microsoft.Maui.Controls.Internals
6+
{
7+
[EditorBrowsable(EditorBrowsableState.Never)]
8+
[Obsolete("This interface is obsolete and will be removed in a future version. Use Microsoft.Maui.Controls.ILineHeightElement instead.")]
9+
interface ILineHeightElement
10+
{
11+
double LineHeight { get; }
12+
13+
void OnLineHeightChanged(double oldValue, double newValue);
14+
}
15+
}
Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,33 @@
1-
#nullable disable
2-
namespace Microsoft.Maui.Controls
1+
namespace Microsoft.Maui.Controls;
2+
3+
/// <summary>
4+
/// Defines properties and methods for elements that support text alignment.
5+
/// </summary>
6+
/// <remarks>
7+
/// This interface is implemented by UI elements that need to control the horizontal and vertical
8+
/// alignment of displayed text.
9+
/// </remarks>
10+
public interface ITextAlignmentElement
311
{
4-
interface ITextAlignmentElement
5-
{
6-
//note to implementor: implement the properties publicly
7-
TextAlignment HorizontalTextAlignment { get; }
12+
/// <summary>
13+
/// Gets the horizontal alignment of the text.
14+
/// </summary>
15+
/// <value>A <see cref="TextAlignment"/> value that specifies how the text is horizontally aligned. The default value depends on the implementing control.</value>
16+
/// <remarks>Implementors should implement this property publicly.</remarks>
17+
TextAlignment HorizontalTextAlignment { get; }
818

9-
TextAlignment VerticalTextAlignment { get; }
19+
/// <summary>
20+
/// Gets the vertical alignment of the text.
21+
/// </summary>
22+
/// <value>A <see cref="TextAlignment"/> value that specifies how the text is vertically aligned. The default value depends on the implementing control.</value>
23+
/// <remarks>Implementors should implement this property publicly.</remarks>
24+
TextAlignment VerticalTextAlignment { get; }
1025

11-
//note to implementor: but implement the methods explicitly
12-
void OnHorizontalTextAlignmentPropertyChanged(TextAlignment oldValue, TextAlignment newValue);
13-
}
14-
}
26+
/// <summary>
27+
/// Called when the <see cref="HorizontalTextAlignment"/> property changes.
28+
/// </summary>
29+
/// <param name="oldValue">The old value of the property.</param>
30+
/// <param name="newValue">The new value of the property.</param>
31+
/// <remarks>Implementors should implement this method explicitly.</remarks>
32+
void OnHorizontalTextAlignmentPropertyChanged(TextAlignment oldValue, TextAlignment newValue);
33+
}

src/Controls/src/Core/ITextElement.cs

Lines changed: 54 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,64 @@
11
#nullable disable
2-
using System;
3-
using Microsoft.Maui.Controls.Internals;
42
using Microsoft.Maui.Graphics;
53

6-
namespace Microsoft.Maui.Controls
4+
namespace Microsoft.Maui.Controls;
5+
6+
/// <summary>
7+
/// Defines properties and methods for elements that display text.
8+
/// </summary>
9+
/// <remarks>
10+
/// This interface is implemented by UI elements that can display text and allows consistent
11+
/// text styling and formatting across different controls.
12+
/// </remarks>
13+
public interface ITextElement
714
{
8-
interface ITextElement
9-
{
10-
//note to implementor: implement this property publicly
11-
Color TextColor { get; }
15+
/// <summary>
16+
/// Gets the color of the text.
17+
/// </summary>
18+
/// <value>The <see cref="Color"/> of the text. The default value depends on the implementing control.</value>
19+
/// <remarks>Implementors should implement this property publicly.</remarks>
20+
Color TextColor { get; }
1221

13-
//note to implementor: but implement this method explicitly
14-
void OnTextColorPropertyChanged(Color oldValue, Color newValue);
22+
/// <summary>
23+
/// Called when the <see cref="TextColor"/> property changes.
24+
/// </summary>
25+
/// <param name="oldValue">The old value of the property.</param>
26+
/// <param name="newValue">The new value of the property.</param>
27+
/// <remarks>Implementors should implement this method explicitly.</remarks>
28+
void OnTextColorPropertyChanged(Color oldValue, Color newValue);
1529

16-
double CharacterSpacing { get; }
30+
/// <summary>
31+
/// Gets the character spacing.
32+
/// </summary>
33+
/// <value>The spacing between characters in the text, in device-independent units. The default is 0.</value>
34+
double CharacterSpacing { get; }
1735

18-
//note to implementor: but implement these methods explicitly
19-
void OnCharacterSpacingPropertyChanged(double oldValue, double newValue);
36+
/// <summary>
37+
/// Called when the <see cref="CharacterSpacing"/> property changes.
38+
/// </summary>
39+
/// <param name="oldValue">The old value of the property.</param>
40+
/// <param name="newValue">The new value of the property.</param>
41+
/// <remarks>Implementors should implement this method explicitly.</remarks>
42+
void OnCharacterSpacingPropertyChanged(double oldValue, double newValue);
2043

21-
TextTransform TextTransform { get; set; }
44+
/// <summary>
45+
/// Gets or sets the text transformation.
46+
/// </summary>
47+
/// <value>A <see cref="TextTransform"/> value that indicates how the text is transformed. The default is <see cref="TextTransform.None"/>.</value>
48+
TextTransform TextTransform { get; set; }
2249

23-
void OnTextTransformChanged(TextTransform oldValue, TextTransform newValue);
50+
/// <summary>
51+
/// Called when the <see cref="TextTransform"/> property changes.
52+
/// </summary>
53+
/// <param name="oldValue">The old value of the property.</param>
54+
/// <param name="newValue">The new value of the property.</param>
55+
void OnTextTransformChanged(TextTransform oldValue, TextTransform newValue);
2456

25-
string UpdateFormsText(string original, TextTransform transform);
26-
}
27-
}
57+
/// <summary>
58+
/// Updates the text according to the specified transformation.
59+
/// </summary>
60+
/// <param name="original">The original text to transform.</param>
61+
/// <param name="transform">The transformation to apply.</param>
62+
/// <returns>The transformed text.</returns>
63+
string UpdateFormsText(string original, TextTransform transform);
64+
}

src/Controls/src/Core/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
[assembly: StyleProperty("visibility", typeof(VisualElement), nameof(VisualElement.IsVisibleProperty), Inherited = true)]
129129
[assembly: StyleProperty("width", typeof(VisualElement), nameof(VisualElement.WidthRequestProperty))]
130130
[assembly: StyleProperty("letter-spacing", typeof(ITextElement), nameof(TextElement.CharacterSpacingProperty), Inherited = true)]
131-
[assembly: StyleProperty("line-height", typeof(ILineHeightElement), nameof(LineHeightElement.LineHeightProperty), Inherited = true)]
131+
[assembly: StyleProperty("line-height", typeof(Microsoft.Maui.Controls.ILineHeightElement), nameof(LineHeightElement.LineHeightProperty), Inherited = true)]
132132

133133
//flex
134134
[assembly: StyleProperty("align-content", typeof(FlexLayout), nameof(FlexLayout.AlignContentProperty))]

src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,25 @@ Microsoft.Maui.Controls.DatePicker.MaximumDate.get -> System.DateTime?
2323
Microsoft.Maui.Controls.DatePicker.MinimumDate.get -> System.DateTime?
2424
Microsoft.Maui.Controls.HybridWebView.InvokeJavaScriptAsync(string! methodName, object?[]? paramValues = null, System.Text.Json.Serialization.Metadata.JsonTypeInfo?[]? paramJsonTypeInfos = null) -> System.Threading.Tasks.Task!
2525
Microsoft.Maui.Controls.HybridWebView.SetInvokeJavaScriptTarget<T>(T! target) -> void
26+
Microsoft.Maui.Controls.ICornerElement
27+
Microsoft.Maui.Controls.ICornerElement.CornerRadius.get -> Microsoft.Maui.CornerRadius
28+
Microsoft.Maui.Controls.ILineHeightElement
29+
Microsoft.Maui.Controls.ILineHeightElement.LineHeight.get -> double
30+
Microsoft.Maui.Controls.ILineHeightElement.OnLineHeightChanged(double oldValue, double newValue) -> void
2631
Microsoft.Maui.Controls.Internals.TextTransformUtilities
32+
Microsoft.Maui.Controls.ITextAlignmentElement
33+
Microsoft.Maui.Controls.ITextAlignmentElement.HorizontalTextAlignment.get -> Microsoft.Maui.TextAlignment
34+
Microsoft.Maui.Controls.ITextAlignmentElement.OnHorizontalTextAlignmentPropertyChanged(Microsoft.Maui.TextAlignment oldValue, Microsoft.Maui.TextAlignment newValue) -> void
35+
Microsoft.Maui.Controls.ITextAlignmentElement.VerticalTextAlignment.get -> Microsoft.Maui.TextAlignment
36+
Microsoft.Maui.Controls.ITextElement
37+
Microsoft.Maui.Controls.ITextElement.CharacterSpacing.get -> double
38+
Microsoft.Maui.Controls.ITextElement.OnCharacterSpacingPropertyChanged(double oldValue, double newValue) -> void
39+
Microsoft.Maui.Controls.ITextElement.OnTextTransformChanged(Microsoft.Maui.TextTransform oldValue, Microsoft.Maui.TextTransform newValue) -> void
40+
Microsoft.Maui.Controls.ITextElement.TextTransform.get -> Microsoft.Maui.TextTransform
41+
Microsoft.Maui.Controls.ITextElement.TextTransform.set -> void
42+
~Microsoft.Maui.Controls.ITextElement.OnTextColorPropertyChanged(Microsoft.Maui.Graphics.Color oldValue, Microsoft.Maui.Graphics.Color newValue) -> void
43+
~Microsoft.Maui.Controls.ITextElement.TextColor.get -> Microsoft.Maui.Graphics.Color
44+
~Microsoft.Maui.Controls.ITextElement.UpdateFormsText(string original, Microsoft.Maui.TextTransform transform) -> string
2745
Microsoft.Maui.Controls.ShadowTypeConverter
2846
Microsoft.Maui.Controls.ShadowTypeConverter.ShadowTypeConverter() -> void
2947
Microsoft.Maui.Controls.StyleableElement.Style.get -> Microsoft.Maui.Controls.Style?

src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,24 @@ static Microsoft.Maui.Controls.ViewExtensions.TranslateToAsync(this Microsoft.Ma
105105
*REMOVED*~Microsoft.Maui.Controls.NavigableElement.StyleClass.set -> void
106106
Microsoft.Maui.Controls.HybridWebView.InvokeJavaScriptAsync(string! methodName, object?[]? paramValues = null, System.Text.Json.Serialization.Metadata.JsonTypeInfo?[]? paramJsonTypeInfos = null) -> System.Threading.Tasks.Task!
107107
Microsoft.Maui.Controls.HybridWebView.SetInvokeJavaScriptTarget<T>(T! target) -> void
108+
Microsoft.Maui.Controls.ICornerElement
109+
Microsoft.Maui.Controls.ICornerElement.CornerRadius.get -> Microsoft.Maui.CornerRadius
110+
Microsoft.Maui.Controls.ILineHeightElement
111+
Microsoft.Maui.Controls.ILineHeightElement.LineHeight.get -> double
112+
Microsoft.Maui.Controls.ILineHeightElement.OnLineHeightChanged(double oldValue, double newValue) -> void
113+
Microsoft.Maui.Controls.ITextAlignmentElement
114+
Microsoft.Maui.Controls.ITextAlignmentElement.HorizontalTextAlignment.get -> Microsoft.Maui.TextAlignment
115+
Microsoft.Maui.Controls.ITextAlignmentElement.OnHorizontalTextAlignmentPropertyChanged(Microsoft.Maui.TextAlignment oldValue, Microsoft.Maui.TextAlignment newValue) -> void
116+
Microsoft.Maui.Controls.ITextAlignmentElement.VerticalTextAlignment.get -> Microsoft.Maui.TextAlignment
117+
Microsoft.Maui.Controls.ITextElement
118+
Microsoft.Maui.Controls.ITextElement.CharacterSpacing.get -> double
119+
Microsoft.Maui.Controls.ITextElement.OnCharacterSpacingPropertyChanged(double oldValue, double newValue) -> void
120+
Microsoft.Maui.Controls.ITextElement.OnTextTransformChanged(Microsoft.Maui.TextTransform oldValue, Microsoft.Maui.TextTransform newValue) -> void
121+
Microsoft.Maui.Controls.ITextElement.TextTransform.get -> Microsoft.Maui.TextTransform
122+
Microsoft.Maui.Controls.ITextElement.TextTransform.set -> void
123+
~Microsoft.Maui.Controls.ITextElement.OnTextColorPropertyChanged(Microsoft.Maui.Graphics.Color oldValue, Microsoft.Maui.Graphics.Color newValue) -> void
124+
~Microsoft.Maui.Controls.ITextElement.TextColor.get -> Microsoft.Maui.Graphics.Color
125+
~Microsoft.Maui.Controls.ITextElement.UpdateFormsText(string original, Microsoft.Maui.TextTransform transform) -> string
108126
~Microsoft.Maui.Controls.ResourceDictionary.SetAndCreateSource<T>(System.Uri value) -> void
109127
~Microsoft.Maui.Controls.WebViewProcessTerminatedEventArgs.PlatformArgs.get -> Microsoft.Maui.Controls.PlatformWebViewProcessTerminatedEventArgs
110128
~Microsoft.Maui.Controls.Xaml.IXamlTypeResolver.Resolve(string qualifiedTypeName, System.IServiceProvider serviceProvider = null, bool expandToExtension = true) -> System.Type

src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,24 @@ static Microsoft.Maui.Controls.ViewExtensions.TranslateToAsync(this Microsoft.Ma
105105
*REMOVED*~Microsoft.Maui.Controls.NavigableElement.StyleClass.set -> void
106106
Microsoft.Maui.Controls.HybridWebView.InvokeJavaScriptAsync(string! methodName, object?[]? paramValues = null, System.Text.Json.Serialization.Metadata.JsonTypeInfo?[]? paramJsonTypeInfos = null) -> System.Threading.Tasks.Task!
107107
Microsoft.Maui.Controls.HybridWebView.SetInvokeJavaScriptTarget<T>(T! target) -> void
108+
Microsoft.Maui.Controls.ICornerElement
109+
Microsoft.Maui.Controls.ICornerElement.CornerRadius.get -> Microsoft.Maui.CornerRadius
110+
Microsoft.Maui.Controls.ILineHeightElement
111+
Microsoft.Maui.Controls.ILineHeightElement.LineHeight.get -> double
112+
Microsoft.Maui.Controls.ILineHeightElement.OnLineHeightChanged(double oldValue, double newValue) -> void
113+
Microsoft.Maui.Controls.ITextAlignmentElement
114+
Microsoft.Maui.Controls.ITextAlignmentElement.HorizontalTextAlignment.get -> Microsoft.Maui.TextAlignment
115+
Microsoft.Maui.Controls.ITextAlignmentElement.OnHorizontalTextAlignmentPropertyChanged(Microsoft.Maui.TextAlignment oldValue, Microsoft.Maui.TextAlignment newValue) -> void
116+
Microsoft.Maui.Controls.ITextAlignmentElement.VerticalTextAlignment.get -> Microsoft.Maui.TextAlignment
117+
Microsoft.Maui.Controls.ITextElement
118+
Microsoft.Maui.Controls.ITextElement.CharacterSpacing.get -> double
119+
Microsoft.Maui.Controls.ITextElement.OnCharacterSpacingPropertyChanged(double oldValue, double newValue) -> void
120+
Microsoft.Maui.Controls.ITextElement.OnTextTransformChanged(Microsoft.Maui.TextTransform oldValue, Microsoft.Maui.TextTransform newValue) -> void
121+
Microsoft.Maui.Controls.ITextElement.TextTransform.get -> Microsoft.Maui.TextTransform
122+
Microsoft.Maui.Controls.ITextElement.TextTransform.set -> void
123+
~Microsoft.Maui.Controls.ITextElement.OnTextColorPropertyChanged(Microsoft.Maui.Graphics.Color oldValue, Microsoft.Maui.Graphics.Color newValue) -> void
124+
~Microsoft.Maui.Controls.ITextElement.TextColor.get -> Microsoft.Maui.Graphics.Color
125+
~Microsoft.Maui.Controls.ITextElement.UpdateFormsText(string original, Microsoft.Maui.TextTransform transform) -> string
108126
~Microsoft.Maui.Controls.ResourceDictionary.SetAndCreateSource<T>(System.Uri value) -> void
109127
~Microsoft.Maui.Controls.Internals.TypedBindingBase.UpdateSourceEventName.set -> void
110128
~Microsoft.Maui.Controls.Xaml.IXamlTypeResolver.Resolve(string qualifiedTypeName, System.IServiceProvider serviceProvider = null, bool expandToExtension = true) -> System.Type

src/Controls/src/Core/PublicAPI/net-tizen/PublicAPI.Unshipped.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,25 @@ Microsoft.Maui.Controls.DatePicker.MaximumDate.get -> System.DateTime?
2323
Microsoft.Maui.Controls.DatePicker.MinimumDate.get -> System.DateTime?
2424
Microsoft.Maui.Controls.HybridWebView.InvokeJavaScriptAsync(string! methodName, object?[]? paramValues = null, System.Text.Json.Serialization.Metadata.JsonTypeInfo?[]? paramJsonTypeInfos = null) -> System.Threading.Tasks.Task!
2525
Microsoft.Maui.Controls.HybridWebView.SetInvokeJavaScriptTarget<T>(T! target) -> void
26+
Microsoft.Maui.Controls.ICornerElement
27+
Microsoft.Maui.Controls.ICornerElement.CornerRadius.get -> Microsoft.Maui.CornerRadius
28+
Microsoft.Maui.Controls.ILineHeightElement
29+
Microsoft.Maui.Controls.ILineHeightElement.LineHeight.get -> double
30+
Microsoft.Maui.Controls.ILineHeightElement.OnLineHeightChanged(double oldValue, double newValue) -> void
2631
Microsoft.Maui.Controls.Internals.TextTransformUtilities
32+
Microsoft.Maui.Controls.ITextAlignmentElement
33+
Microsoft.Maui.Controls.ITextAlignmentElement.HorizontalTextAlignment.get -> Microsoft.Maui.TextAlignment
34+
Microsoft.Maui.Controls.ITextAlignmentElement.OnHorizontalTextAlignmentPropertyChanged(Microsoft.Maui.TextAlignment oldValue, Microsoft.Maui.TextAlignment newValue) -> void
35+
Microsoft.Maui.Controls.ITextAlignmentElement.VerticalTextAlignment.get -> Microsoft.Maui.TextAlignment
36+
Microsoft.Maui.Controls.ITextElement
37+
Microsoft.Maui.Controls.ITextElement.CharacterSpacing.get -> double
38+
Microsoft.Maui.Controls.ITextElement.OnCharacterSpacingPropertyChanged(double oldValue, double newValue) -> void
39+
Microsoft.Maui.Controls.ITextElement.OnTextTransformChanged(Microsoft.Maui.TextTransform oldValue, Microsoft.Maui.TextTransform newValue) -> void
40+
Microsoft.Maui.Controls.ITextElement.TextTransform.get -> Microsoft.Maui.TextTransform
41+
Microsoft.Maui.Controls.ITextElement.TextTransform.set -> void
42+
~Microsoft.Maui.Controls.ITextElement.OnTextColorPropertyChanged(Microsoft.Maui.Graphics.Color oldValue, Microsoft.Maui.Graphics.Color newValue) -> void
43+
~Microsoft.Maui.Controls.ITextElement.TextColor.get -> Microsoft.Maui.Graphics.Color
44+
~Microsoft.Maui.Controls.ITextElement.UpdateFormsText(string original, Microsoft.Maui.TextTransform transform) -> string
2745
Microsoft.Maui.Controls.ShadowTypeConverter
2846
Microsoft.Maui.Controls.ShadowTypeConverter.ShadowTypeConverter() -> void
2947
Microsoft.Maui.Controls.StyleableElement.Style.get -> Microsoft.Maui.Controls.Style?

0 commit comments

Comments
 (0)