44
55using CommunityToolkit . Notifications . Adaptive . Elements ;
66
7- namespace CommunityToolkit . Notifications
7+ namespace CommunityToolkit . Notifications ;
8+
9+ /// <summary>
10+ /// An inline image.
11+ /// </summary>
12+ public sealed class AdaptiveImage
13+ : IBaseImage ,
14+ IToastBindingGenericChild ,
15+ ITileBindingContentAdaptiveChild ,
16+ IAdaptiveChild ,
17+ IAdaptiveSubgroupChild
818{
919 /// <summary>
10- /// An inline image.
20+ /// Gets or sets the desired cropping of the image.
21+ /// Supported on Tiles since RTM. Supported on Toast since Anniversary Update.
1122 /// </summary>
12- public sealed class AdaptiveImage
13- : IBaseImage ,
14- IToastBindingGenericChild ,
15- ITileBindingContentAdaptiveChild ,
16- IAdaptiveChild ,
17- IAdaptiveSubgroupChild
18- {
19- /// <summary>
20- /// Gets or sets the desired cropping of the image.
21- /// Supported on Tiles since RTM. Supported on Toast since Anniversary Update.
22- /// </summary>
23- public AdaptiveImageCrop HintCrop { get ; set ; }
23+ public AdaptiveImageCrop HintCrop { get ; set ; }
2424
25- /// <summary>
26- /// Gets or sets a value whether a margin is removed. images have an 8px margin around them.
27- /// You can remove this margin by setting this property to true.
28- /// Supported on Tiles since RTM. Supported on Toast since Anniversary Update.
29- /// </summary>
30- public bool ? HintRemoveMargin { get ; set ; }
25+ /// <summary>
26+ /// Gets or sets a value whether a margin is removed. images have an 8px margin around them.
27+ /// You can remove this margin by setting this property to true.
28+ /// Supported on Tiles since RTM. Supported on Toast since Anniversary Update.
29+ /// </summary>
30+ public bool ? HintRemoveMargin { get ; set ; }
3131
32- /// <summary>
33- /// Gets or sets the horizontal alignment of the image.
34- /// For Toast, this is only supported when inside an <see cref="AdaptiveSubgroup"/>.
35- /// </summary>
36- public AdaptiveImageAlign HintAlign { get ; set ; }
32+ /// <summary>
33+ /// Gets or sets the horizontal alignment of the image.
34+ /// For Toast, this is only supported when inside an <see cref="AdaptiveSubgroup"/>.
35+ /// </summary>
36+ public AdaptiveImageAlign HintAlign { get ; set ; }
3737
38- private string _source ;
38+ private string _source ;
3939
40- /// <summary>
41- /// Gets or sets the URI of the image (Required).
42- /// Can be from your application package, application data, or the internet.
43- /// Internet images must be less than 200 KB in size.
44- /// </summary>
45- public string Source
46- {
47- get { return _source ; }
48- set { BaseImageHelper . SetSource ( ref _source , value ) ; }
49- }
40+ /// <summary>
41+ /// Gets or sets the URI of the image (Required).
42+ /// Can be from your application package, application data, or the internet.
43+ /// Internet images must be less than 200 KB in size.
44+ /// </summary>
45+ public string Source
46+ {
47+ get { return _source ; }
48+ set { BaseImageHelper . SetSource ( ref _source , value ) ; }
49+ }
5050
51- /// <summary>
52- /// Gets or sets a description of the image, for users of assistive technologies.
53- /// </summary>
54- public string AlternateText { get ; set ; }
51+ /// <summary>
52+ /// Gets or sets a description of the image, for users of assistive technologies.
53+ /// </summary>
54+ public string AlternateText { get ; set ; }
5555
56- /// <summary>
57- /// Gets or sets set to true to allow Windows to append a query string to the image URI
58- /// supplied in the Tile notification. Use this attribute if your server hosts
59- /// images and can handle query strings, either by retrieving an image variant based
60- /// on the query strings or by ignoring the query string and returning the image
61- /// as specified without the query string. This query string specifies scale,
62- /// contrast setting, and language.
63- /// </summary>
64- public bool ? AddImageQuery { get ; set ; }
56+ /// <summary>
57+ /// Gets or sets set to true to allow Windows to append a query string to the image URI
58+ /// supplied in the Tile notification. Use this attribute if your server hosts
59+ /// images and can handle query strings, either by retrieving an image variant based
60+ /// on the query strings or by ignoring the query string and returning the image
61+ /// as specified without the query string. This query string specifies scale,
62+ /// contrast setting, and language.
63+ /// </summary>
64+ public bool ? AddImageQuery { get ; set ; }
6565
66- /// <summary>
67- /// Returns the image's source string.
68- /// </summary>
69- /// <returns>The image's source string.</returns>
70- public override string ToString ( )
66+ /// <summary>
67+ /// Returns the image's source string.
68+ /// </summary>
69+ /// <returns>The image's source string.</returns>
70+ public override string ToString ( )
71+ {
72+ if ( Source == null )
7173 {
72- if ( Source == null )
73- {
74- return "Source is null" ;
75- }
76-
77- return Source ;
74+ return "Source is null" ;
7875 }
7976
80- internal Element_AdaptiveImage ConvertToElement ( )
81- {
82- Element_AdaptiveImage image = BaseImageHelper . CreateBaseElement ( this ) ;
77+ return Source ;
78+ }
8379
84- image . Crop = HintCrop ;
85- image . RemoveMargin = HintRemoveMargin ;
86- image . Align = HintAlign ;
87- image . Placement = AdaptiveImagePlacement . Inline ;
80+ internal Element_AdaptiveImage ConvertToElement ( )
81+ {
82+ Element_AdaptiveImage image = BaseImageHelper . CreateBaseElement ( this ) ;
8883
89- return image ;
90- }
84+ image . Crop = HintCrop ;
85+ image . RemoveMargin = HintRemoveMargin ;
86+ image . Align = HintAlign ;
87+ image . Placement = AdaptiveImagePlacement . Inline ;
88+
89+ return image ;
9190 }
9291}
0 commit comments