From d51810b336801008362f3136383ce592337f25c8 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Sat, 23 Jan 2021 00:13:56 -0500 Subject: [PATCH] Complete docs for new icon types --- src/Avalonia.Controls/FontIcon.cs | 48 +++++++++++----------- src/Avalonia.Controls/IconElement.cs | 3 ++ src/Avalonia.Controls/IconSourceElement.cs | 24 +++++++++++ src/Avalonia.Controls/ImageIcon.cs | 22 +++++----- src/Avalonia.Controls/PathIcon.cs | 4 ++ 5 files changed, 64 insertions(+), 37 deletions(-) diff --git a/src/Avalonia.Controls/FontIcon.cs b/src/Avalonia.Controls/FontIcon.cs index 2c22643caa..f8f08d9c64 100644 --- a/src/Avalonia.Controls/FontIcon.cs +++ b/src/Avalonia.Controls/FontIcon.cs @@ -3,11 +3,20 @@ using Avalonia.Media; namespace Avalonia.Controls { + /// + /// Represents an icon that uses a glyph from the specified font. + /// public class FontIcon : IconElement { + /// + /// Gets the identifier for the dependency property. + /// public static readonly StyledProperty GlyphProperty = AvaloniaProperty.Register(nameof(Glyph)); - + + /// + /// Gets or sets the character code that identifies the icon glyph. + /// public string Glyph { get => GetValue(GlyphProperty); @@ -15,71 +24,60 @@ namespace Avalonia.Controls } } + /// + /// Represents an icon source that uses a glyph from the specified font. + /// public class FontIconSource : IconSource { + /// public static readonly StyledProperty GlyphProperty = FontIcon.GlyphProperty.AddOwner(); - /// - /// Defines the property. - /// + /// public static readonly StyledProperty FontFamilyProperty = TextBlock.FontFamilyProperty.AddOwner(); - /// - /// Defines the property. - /// + /// public static readonly StyledProperty FontSizeProperty = TextBlock.FontSizeProperty.AddOwner(); - /// - /// Defines the property. - /// + /// public static readonly StyledProperty FontStyleProperty = TextBlock.FontStyleProperty.AddOwner(); - /// - /// Defines the property. - /// + /// public static readonly StyledProperty FontWeightProperty = TextBlock.FontWeightProperty.AddOwner(); + /// public string Glyph { get => GetValue(GlyphProperty); set => SetValue(GlyphProperty, value); } - /// - /// Gets or sets the font family used to draw the control's text. - /// + /// public FontFamily FontFamily { get => GetValue(FontFamilyProperty); set => SetValue(FontFamilyProperty, value); } - /// - /// Gets or sets the size of the control's text in points. - /// + /// public double FontSize { get => GetValue(FontSizeProperty); set => SetValue(FontSizeProperty, value); } - /// - /// Gets or sets the font style used to draw the control's text. - /// + /// public FontStyle FontStyle { get => GetValue(FontStyleProperty); set => SetValue(FontStyleProperty, value); } - /// - /// Gets or sets the font weight used to draw the control's text. - /// + /// public FontWeight FontWeight { get => GetValue(FontWeightProperty); diff --git a/src/Avalonia.Controls/IconElement.cs b/src/Avalonia.Controls/IconElement.cs index 82b7a0660c..f1f73b5705 100644 --- a/src/Avalonia.Controls/IconElement.cs +++ b/src/Avalonia.Controls/IconElement.cs @@ -2,6 +2,9 @@ namespace Avalonia.Controls { + /// + /// Represents the base class for an icon UI element. + /// public abstract class IconElement : TemplatedControl { diff --git a/src/Avalonia.Controls/IconSourceElement.cs b/src/Avalonia.Controls/IconSourceElement.cs index 81624173fa..0103ca309f 100644 --- a/src/Avalonia.Controls/IconSourceElement.cs +++ b/src/Avalonia.Controls/IconSourceElement.cs @@ -6,11 +6,24 @@ using Avalonia.Metadata; namespace Avalonia.Controls { + /// + /// Represents an icon that uses an IconSource as its content. + /// + /// + /// is similar to IconElement. However, because it is not a , it can be shared. + /// provides a wrapper that lets you use an IconSource in places that require an IconElement. + /// public class IconSourceElement : IconElement { + /// + /// Identifies the IconSource dependency property. + /// public static readonly StyledProperty IconSourceProperty = AvaloniaProperty.Register(nameof(IconSource)); + /// + /// Gets or sets the IconSource used as the icon content. + /// [Content] public IconSource? IconSource { @@ -19,17 +32,28 @@ namespace Avalonia.Controls } } + /// + /// Represents the base class for an icon source. + /// + /// + /// is similar to IconElement. However, because it is not a , it can be shared. + /// public abstract class IconSource : AvaloniaObject { + /// public static StyledProperty ForegroundProperty = TemplatedControl.ForegroundProperty.AddOwner(); + /// public IBrush? Foreground { get => GetValue(ForegroundProperty); set => SetValue(ForegroundProperty, value); } + /// + /// Gets the data template used to display . + /// public abstract IDataTemplate IconElementTemplate { get; } } } diff --git a/src/Avalonia.Controls/ImageIcon.cs b/src/Avalonia.Controls/ImageIcon.cs index 53df0e50b8..cfc65e6f0c 100644 --- a/src/Avalonia.Controls/ImageIcon.cs +++ b/src/Avalonia.Controls/ImageIcon.cs @@ -3,17 +3,16 @@ using Avalonia.Media; namespace Avalonia.Controls { + /// + /// Represents an icon that uses a image source as its content. + /// public class ImageIcon : IconElement { - /// - /// Defines the property. - /// + /// public static readonly StyledProperty SourceProperty = Image.SourceProperty.AddOwner(); - /// - /// Gets or sets the image that will be displayed. - /// + /// public IImage Source { get => GetValue(SourceProperty); @@ -21,17 +20,16 @@ namespace Avalonia.Controls } } + /// + /// Represents an icon source that uses a image source as its content. + /// public class ImageIconSource : IconSource { - /// - /// Defines the property. - /// + /// public static readonly StyledProperty SourceProperty = Image.SourceProperty.AddOwner(); - /// - /// Gets or sets the image that will be displayed. - /// + /// public IImage Source { get => GetValue(SourceProperty); diff --git a/src/Avalonia.Controls/PathIcon.cs b/src/Avalonia.Controls/PathIcon.cs index e9e387ee54..6cd3e3acce 100644 --- a/src/Avalonia.Controls/PathIcon.cs +++ b/src/Avalonia.Controls/PathIcon.cs @@ -11,9 +11,11 @@ namespace Avalonia.Controls AffectsRender(DataProperty); } + /// public static readonly StyledProperty DataProperty = Path.DataProperty.AddOwner(); + /// public Geometry Data { get => GetValue(DataProperty); @@ -23,9 +25,11 @@ namespace Avalonia.Controls public class PathIconSource : IconSource { + /// public static readonly StyledProperty DataProperty = Path.DataProperty.AddOwner(); + /// public Geometry Data { get => GetValue(DataProperty);