Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix remaining (API) docs warnings #10090

Merged
merged 12 commits into from
Sep 28, 2022

This file was deleted.

16 changes: 10 additions & 6 deletions src/Controls/src/Core/AcceleratorTypeConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,22 @@

namespace Microsoft.Maui.Controls
{
/// <include file="../../docs/Microsoft.Maui.Controls/AcceleratorTypeConverter.xml" path="Type[@FullName='Microsoft.Maui.Controls.AcceleratorTypeConverter']/Docs/*" />
/// <summary>
/// Class that the XAML parser uses to convert strings to <see cref="Accelerator" /> objects.
/// </summary>
/// <remarks>
/// The given string value may contain a combination of "CTRL", "CMD", "ALT", "SHIFT", "FN", or "WIN",
/// in any combination of upper or lower case letters, as well as any available keys on the platform.
/// The returned <see cref="Accelerator" /> has its <see cref="Accelerator.Modifiers" /> array filled with the specified modifiers,
/// and its <see cref="Accelerator.Keys" /> array filled with the remaining keys.</remarks>
public class AcceleratorTypeConverter : TypeConverter
{
/// <include file="../../docs/Microsoft.Maui.Controls/AcceleratorTypeConverter.xml" path="//Member[@MemberName='CanConvertFrom']/Docs/*" />
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
=> sourceType == typeof(string);

/// <include file="../../docs/Microsoft.Maui.Controls/AcceleratorTypeConverter.xml" path="//Member[@MemberName='CanConvertTo']/Docs/*" />
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
=> destinationType == typeof(string);

/// <include file="../../docs/Microsoft.Maui.Controls/AcceleratorTypeConverter.xml" path="//Member[@MemberName='ConvertFrom']/Docs/*" />

public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
{
var strValue = value?.ToString();
Expand All @@ -26,11 +30,11 @@ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo c
return Accelerator.FromString(strValue);
}

/// <include file="../../docs/Microsoft.Maui.Controls/AcceleratorTypeConverter.xml" path="//Member[@MemberName='ConvertTo']/Docs/*" />
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
if (value is not Accelerator acc)
throw new NotSupportedException();

return acc.ToString();
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/Controls/src/Core/ActivityIndicator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public bool IsRunning
get { return (bool)GetValue(IsRunningProperty); }
set { SetValue(IsRunningProperty, value); }
}
/// <include file="../../docs/Microsoft.Maui.Controls/ActivityIndicator.xml" path="//Member[@MemberName='On']/Docs/*" />

/// <inheritdoc/>
public IPlatformElementConfiguration<T, ActivityIndicator> On<T>() where T : IConfigPlatform
{
return _platformConfigurationRegistry.Value.On<T>();
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/src/Core/Application.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ internal void NotifyOfWindowModalEvent(EventArgs eventArgs)
[Obsolete("Properties API is obsolete, use Microsoft.Maui.Storage.Preferences instead.", error: true)]
public Task SavePropertiesAsync() => throw new NotSupportedException("Properties API is obsolete, use Microsoft.Maui.Storage.Preferences instead.");

/// <include file="../../docs/Microsoft.Maui.Controls/Application.xml" path="//Member[@MemberName='On']/Docs/*" />
/// <inheritdoc/>
public IPlatformElementConfiguration<T, Application> On<T>() where T : IConfigPlatform
{
return _platformConfigurationRegistry.Value.On<T>();
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/src/Core/BoxView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public CornerRadius CornerRadius
set => SetValue(CornerElement.CornerRadiusProperty, value);
}

/// <include file="../../docs/Microsoft.Maui.Controls/BoxView.xml" path="//Member[@MemberName='On']/Docs/*" />
/// <inheritdoc/>
public IPlatformElementConfiguration<T, BoxView> On<T>() where T : IConfigPlatform
{
return _platformConfigurationRegistry.Value.On<T>();
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/src/Core/Button.cs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public Button()
_platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<Button>>(() => new PlatformConfigurationRegistry<Button>(this));
}

/// <include file="../../docs/Microsoft.Maui.Controls/Button.xml" path="//Member[@MemberName='On']/Docs/*" />
/// <inheritdoc/>
public IPlatformElementConfiguration<T, Button> On<T>() where T : IConfigPlatform
{
return _platformConfigurationRegistry.Value.On<T>();
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/src/Core/CarouselPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public CarouselPage()
_platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<CarouselPage>>(() => new PlatformConfigurationRegistry<CarouselPage>(this));
}

/// <include file="../../docs/Microsoft.Maui.Controls/CarouselPage.xml" path="//Member[@MemberName='On']/Docs/*" />
/// <inheritdoc/>
public new IPlatformElementConfiguration<T, CarouselPage> On<T>() where T : IConfigPlatform
{
return _platformConfigurationRegistry.Value.On<T>();
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/src/Core/Cells/Cell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,6 @@ void OnParentPropertyChanging(object sender, PropertyChangingEventArgs e)
// This creates a nested class to keep track of IElementConfiguration<Cell> because adding
// IElementConfiguration<Cell> to the Cell itself tanks performance on UWP ListViews
// Issue has been logged with UWP
/// <include file="../../../docs/Microsoft.Maui.Controls/Cell.xml" path="//Member[@MemberName='On']/Docs/*" />
public IPlatformElementConfiguration<T, Cell> On<T>() where T : IConfigPlatform
{
return GetElementConfiguration().On<T>();
Expand All @@ -346,6 +345,7 @@ public ElementConfiguration(Cell cell)
new Lazy<PlatformConfigurationRegistry<Cell>>(() => new PlatformConfigurationRegistry<Cell>(cell));
}

/// <inheritdoc/>
public IPlatformElementConfiguration<T, Cell> On<T>() where T : IConfigPlatform
{
return _platformConfigurationRegistry.Value.On<T>();
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/src/Core/CheckBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected internal override void ChangeVisualState()

public event EventHandler<CheckedChangedEventArgs> CheckedChanged;

/// <include file="../../docs/Microsoft.Maui.Controls/CheckBox.xml" path="//Member[@MemberName='On']/Docs/*" />
/// <inheritdoc/>
public IPlatformElementConfiguration<T, CheckBox> On<T>() where T : IConfigPlatform
{
return _platformConfigurationRegistry.Value.On<T>();
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/src/Core/DatePicker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ static bool ValidateMinimumDate(BindableObject bindable, object value)
return ((DateTime)value).Date <= ((DatePicker)bindable).MaximumDate.Date;
}

/// <include file="../../docs/Microsoft.Maui.Controls/DatePicker.xml" path="//Member[@MemberName='On']/Docs/*" />
/// <inheritdoc/>
public IPlatformElementConfiguration<T, DatePicker> On<T>() where T : IConfigPlatform
{
return _platformConfigurationRegistry.Value.On<T>();
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/src/Core/Editor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public Editor()
_platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<Editor>>(() => new PlatformConfigurationRegistry<Editor>(this));
}

/// <include file="../../docs/Microsoft.Maui.Controls/Editor.xml" path="//Member[@MemberName='On']/Docs/*" />
/// <inheritdoc/>
public IPlatformElementConfiguration<T, Editor> On<T>() where T : IConfigPlatform
{
return _platformConfigurationRegistry.Value.On<T>();
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/src/Core/Entry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public void SendCompleted()
}
}

/// <include file="../../docs/Microsoft.Maui.Controls/Entry.xml" path="//Member[@MemberName='On']/Docs/*" />
/// <inheritdoc/>
public IPlatformElementConfiguration<T, Entry> On<T>() where T : IConfigPlatform
{
return _platformConfigurationRegistry.Value.On<T>();
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/src/Core/FlyoutPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ public FlyoutPage()

readonly Lazy<PlatformConfigurationRegistry<FlyoutPage>> _platformConfigurationRegistry;

/// <include file="../../docs/Microsoft.Maui.Controls/FlyoutPage.xml" path="//Member[@MemberName='On']/Docs/*" />
/// <inheritdoc/>
public new IPlatformElementConfiguration<T, FlyoutPage> On<T>() where T : IConfigPlatform
{
return _platformConfigurationRegistry.Value.On<T>();
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/src/Core/Frame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public float CornerRadius

double IBorderElement.BorderWidthDefaultValue => -1d;

/// <include file="../../docs/Microsoft.Maui.Controls/Frame.xml" path="//Member[@MemberName='On']/Docs/*" />
/// <inheritdoc/>
public IPlatformElementConfiguration<T, Frame> On<T>() where T : IConfigPlatform
{
return _platformConfigurationRegistry.Value.On<T>();
Expand Down
9 changes: 9 additions & 0 deletions src/Controls/src/Core/IElementConfiguration.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@

namespace Microsoft.Maui.Controls
{
/// <summary>
/// Helper that handles storing and lookup of platform specifics implementations
/// </summary>
/// <typeparam name="TElement">The element type.</typeparam>
public interface IElementConfiguration<out TElement> where TElement : Element
{
/// <summary>
/// Returns the platform-specific instance of this <typeparamref name="TElement"/>, on which a platform-specific method may be called.
/// </summary>
/// <typeparam name="T">A type of <see cref="IConfigPlatform"/> which specifies the platform to retrieve for.</typeparam>
/// <returns>A platform-specific instance of <typeparamref name="TElement"/>.</returns>
IPlatformElementConfiguration<T, TElement> On<T>() where T : IConfigPlatform;
}
}
2 changes: 1 addition & 1 deletion src/Controls/src/Core/Image.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ protected override SizeRequest OnMeasure(double widthConstraint, double heightCo
return ImageElement.Measure(this, desiredSize, widthConstraint, heightConstraint);
}

/// <include file="../../docs/Microsoft.Maui.Controls/Image.xml" path="//Member[@MemberName='On']/Docs/*" />
/// <inheritdoc/>
public IPlatformElementConfiguration<T, Image> On<T>() where T : IConfigPlatform
{
return _platformConfigurationRegistry.Value.On<T>();
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/src/Core/ImageButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ protected override SizeRequest OnMeasure(double widthConstraint, double heightCo
return ImageElement.Measure(this, desiredSize, widthConstraint, heightConstraint);
}

/// <include file="../../docs/Microsoft.Maui.Controls/ImageButton.xml" path="//Member[@MemberName='On']/Docs/*" />
/// <inheritdoc/>
public IPlatformElementConfiguration<T, ImageButton> On<T>() where T : IConfigPlatform => _platformConfigurationRegistry.Value.On<T>();

int IBorderElement.CornerRadiusDefaultValue => (int)CornerRadiusProperty.DefaultValue;
Expand Down
36 changes: 33 additions & 3 deletions src/Controls/src/Core/Interactivity/Behavior.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
using System;
using Microsoft.Maui.Controls.Internals;

namespace Microsoft.Maui.Controls
{
/// <include file="../../../docs/Microsoft.Maui.Controls/Behavior.xml" path="Type[@FullName='Microsoft.Maui.Controls.Behavior' and position()=0]/Docs/*" />
/// <summary>
/// Base class for generalized user-defined behaviors that can respond to arbitrary conditions and events.
/// </summary>
/// <remarks>Application developers should specialize the <see cref="Behavior{T}" /> generic class, instead of directly using <see cref="Behavior" />.</remarks>
public abstract class Behavior : BindableObject, IAttachedObject
{
/// <summary>
/// Creates a new <see cref="Behavior" /> with default values.
/// </summary>
protected Behavior() : this(typeof(BindableObject))
{
}

internal Behavior(Type associatedType) => AssociatedType = associatedType ?? throw new ArgumentNullException(nameof(associatedType));

/// <summary>
/// Gets the type of the objects with which this <see cref="Behavior" /> can be associated.
/// </summary>
protected Type AssociatedType { get; }

void IAttachedObject.AttachTo(BindableObject bindable)
Expand All @@ -25,38 +33,60 @@ void IAttachedObject.AttachTo(BindableObject bindable)

void IAttachedObject.DetachFrom(BindableObject bindable) => OnDetachingFrom(bindable);

/// <summary>
/// Application developers override this method to implement the behaviors that will be associated with <paramref name="bindable" />.
/// </summary>
/// <param name="bindable">The bindable object to which the behavior was attached.</param>
protected virtual void OnAttachedTo(BindableObject bindable)
{
}

/// <summary>
/// Application developers override this method to remove the behaviors from <paramref name="bindable" />
/// that were implemented in a previous call to the <see cref="OnAttachedTo(BindableObject)"/> method.
/// </summary>
/// <param name="bindable">The bindable object from which the behavior was detached.</param>
protected virtual void OnDetachingFrom(BindableObject bindable)
{
}
}

/// <include file="../../../docs/Microsoft.Maui.Controls/Behavior.xml" path="Type[@FullName='Microsoft.Maui.Controls.Behavior' and position()=1]/Docs/*" />
/// <inheritdoc/>
/// <typeparam name="T">The type of object this behavior will be applied to.</typeparam>
public abstract class Behavior<T> : Behavior where T : BindableObject
{
/// <inheritdoc/>
protected Behavior() : base(typeof(T))
{
}

/// <inheritdoc/>
protected override void OnAttachedTo(BindableObject bindable)
{
base.OnAttachedTo(bindable);
OnAttachedTo((T)bindable);
}

/// <summary>
/// Application developers override this method to implement the behaviors that will be associated with <paramref name="bindable" />.
/// </summary>
/// <param name="bindable">The bindable object to which the behavior was attached.</param>
protected virtual void OnAttachedTo(T bindable)
{
}

/// <inheritdoc/>
protected override void OnDetachingFrom(BindableObject bindable)
{
OnDetachingFrom((T)bindable);
base.OnDetachingFrom(bindable);
}

/// <summary>
/// Application developers override this method to remove the behaviors from <paramref name="bindable" />
/// that were implemented in a previous call to the <see cref="OnAttachedTo(T)"/> method.
/// </summary>
/// <param name="bindable">The bindable object from which the behavior was detached.</param>
protected virtual void OnDetachingFrom(T bindable)
{
}
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/src/Core/Label.cs
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ static void OnTextPropertyChanged(BindableObject bindable, object oldvalue, obje
((Label)bindable).FormattedText = null;
}

/// <include file="../../docs/Microsoft.Maui.Controls/Label.xml" path="//Member[@MemberName='On']/Docs/*" />
/// <inheritdoc/>
public IPlatformElementConfiguration<T, Label> On<T>() where T : IConfigPlatform
{
return _platformConfigurationRegistry.Value.On<T>();
Expand Down
1 change: 1 addition & 0 deletions src/Controls/src/Core/LegacyLayouts/AbsoluteLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public AbsoluteLayout()
new PlatformConfigurationRegistry<AbsoluteLayout>(this));
}

/// <inheritdoc/>
public IPlatformElementConfiguration<T, AbsoluteLayout> On<T>() where T : IConfigPlatform
{
return _platformConfigurationRegistry.Value.On<T>();
Expand Down
1 change: 1 addition & 0 deletions src/Controls/src/Core/LegacyLayouts/Grid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public Grid()
new PlatformConfigurationRegistry<Grid>(this));
}

/// <inheritdoc/>
public IPlatformElementConfiguration<T, Grid> On<T>() where T : IConfigPlatform
{
return _platformConfigurationRegistry.Value.On<T>();
Expand Down
1 change: 1 addition & 0 deletions src/Controls/src/Core/LegacyLayouts/RelativeLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public RelativeLayout()
new PlatformConfigurationRegistry<RelativeLayout>(this));
}

/// <inheritdoc/>
public IPlatformElementConfiguration<T, RelativeLayout> On<T>() where T : IConfigPlatform
{
return _platformConfigurationRegistry.Value.On<T>();
Expand Down
1 change: 1 addition & 0 deletions src/Controls/src/Core/LegacyLayouts/StackLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public StackLayout()
new PlatformConfigurationRegistry<StackLayout>(this));
}

/// <inheritdoc/>
public IPlatformElementConfiguration<T, StackLayout> On<T>() where T : IConfigPlatform
{
return _platformConfigurationRegistry.Value.On<T>();
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/src/Core/ListView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ static bool ValidateHeaderFooterTemplate(BindableObject bindable, object value)
return template.CreateContent() is View;
}

/// <include file="../../docs/Microsoft.Maui.Controls/ListView.xml" path="//Member[@MemberName='On']/Docs/*" />
/// <inheritdoc/>
public IPlatformElementConfiguration<T, ListView> On<T>() where T : IConfigPlatform
{
return _platformConfigurationRegistry.Value.On<T>();
Expand Down
Loading