/// Groups semantically identify that the content in the group must either be displayed as a whole, or not displayed if it cannot fit. Groups also allow creating multiple columns. Supported on Tiles since RTM. Supported on Toasts since Anniversary Update.
/// The only valid children of groups are <see cref="AdaptiveSubgroup"/>. Each subgroup is displayed as a separate vertical column. Note that you must include at least one subgroup in your group, otherwise an <see cref="InvalidOperationException"/> will be thrown when you try to retrieve the XML for the notification.
/// Control the desired cropping of the image. Supported on Tiles since RTM. Supported on Toast since Anniversary Update.
/// </summary>
publicAdaptiveImageCropHintCrop{get;set;}
/// <summary>
/// By default, images have an 8px margin around them. You can remove this margin by setting this property to true. Supported on Tiles since RTM. Supported on Toast since Anniversary Update.
/// </summary>
publicbool?HintRemoveMargin{get;set;}
/// <summary>
/// The horizontal alignment of the image. For Toast, this is only supported when inside an <see cref="AdaptiveSubgroup"/>.
/// </summary>
publicAdaptiveImageAlignHintAlign{get;set;}
privatestring_source;
/// <summary>
/// Required. The URI of the image. Can be from your application package, application data, or the internet. Internet images must be less than 200 KB in size.
/// </summary>
publicstringSource
{
get{return_source;}
set{BaseImageHelper.SetSource(ref_source,value);}
}
/// <summary>
/// A description of the image, for users of assistive technologies.
/// </summary>
publicstringAlternateText{get;set;}
/// <summary>
/// Set to true to allow Windows to append a query string to the image URI supplied in the Tile notification. Use this attribute if your server hosts images and can handle query strings, either by retrieving an image variant based on the query strings or by ignoring the query string and returning the image as specified without the query string. This query string specifies scale, contrast setting, and language.
/// Gets or sets an optional string to be displayed instead of the default percentage string. If this isn't provided, something like "70%" will be displayed.
/// </summary>
public
#if WINRT
string
#else
BindableString
#endif
ValueStringOverride{get;set;}
/// <summary>
/// Required. Gets or sets a status string, which is displayed underneath the progress bar. This string should reflect the status of the operation, like "Downloading..." or "Installing..."
// Note that this code is only compiled for WinRT. It is not compiled in any of the other projects.
#if WINRT
/// <summary>
/// An enumeration of the properties that support data binding on <see cref="AdaptiveProgressBar"/> .
/// </summary>
publicenumAdaptiveProgressBarBindableProperty
{
/// <summary>
/// An optional title string
/// </summary>
Title,
/// <summary>
/// The value of the progress bar.
/// </summary>
Value,
/// <summary>
/// An optional string to be displayed instead of the default percentage string. If this isn't provided, something like "70%" will be displayed.
/// </summary>
ValueStringOverride,
/// <summary>
/// An optional status string, which is displayed underneath the progress bar. If provided, this string should reflect the status of the download, like "Downloading..." or "Installing...".
/// The text to display. Data binding support added in Creators Update, only works for toast top-level text elements.
/// </summary>
public
#if WINRT
string
#else
BindableString
#endif
Text{get;set;}
/// <summary>
/// The target locale of the XML payload, specified as a BCP-47 language tags such as "en-US" or "fr-FR". The locale specified here overrides any other specified locale, such as that in binding or visual. If this value is a literal string, this attribute defaults to the user's UI language. If this value is a string reference, this attribute defaults to the locale chosen by Windows Runtime in resolving the string.
/// </summary>
publicstringLanguage{get;set;}
/// <summary>
/// The style controls the text's font size, weight, and opacity. Note that for Toast, the style will only take effect if the text is inside an <see cref="AdaptiveSubgroup"/>.
/// </summary>
publicAdaptiveTextStyleHintStyle{get;set;}
/// <summary>
/// Set this to true to enable text wrapping. For Tiles, this is false by default. For Toasts, this is true on top-level text elements, and false inside an <see cref="AdaptiveSubgroup"/>. Note that for Toast, setting wrap will only take effect if the text is inside an <see cref="AdaptiveSubgroup"/> (you can use HintMaxLines = 1 to prevent top-level text elements from wrapping).
/// </summary>
publicbool?HintWrap{get;set;}
privateint?_hintMaxLines;
/// <summary>
/// The maximum number of lines the text element is allowed to display. For Tiles, this is infinity by default. For Toasts, top-level text elements will have varying max line amounts (and in the Anniversary Update you can change the max lines). Text on a Toast inside an <see cref="AdaptiveSubgroup"/> will behave identically to Tiles (default to infinity).
/// The minimum number of lines the text element must display. Note that for Toast, this property will only take effect if the text is inside an <see cref="AdaptiveSubgroup"/>.
/// The horizontal alignment of the text. Note that for Toast, this property will only take effect if the text is inside an <see cref="AdaptiveSubgroup"/>.
/// Elements that can be direct children of adaptive content, including (<see cref="AdaptiveText"/>, <see cref="AdaptiveImage"/>, and <see cref="AdaptiveGroup"/>).
/// </summary>
publicinterfaceIAdaptiveChild
{
// Blank interface simply for compile-enforcing the child types in the list.
/// Contains the base properties that an image needs.
/// </summary>
publicinterfaceIBaseImage
{
/// <summary>
/// The URI of the image. Can be from your application package, application data, or the internet. Internet images must be less than 200 KB in size.
/// </summary>
stringSource{get;set;}
/// <summary>
/// A description of the image, for users of assistive technologies.
/// </summary>
stringAlternateText{get;set;}
/// <summary>
/// Set to true to allow Windows to append a query string to the image URI supplied in the Tile notification. Use this attribute if your server hosts images and can handle query strings, either by retrieving an image variant based on the query strings or by ignoring the query string and returning the image as specified without the query string. This query string specifies scale, contrast setting, and language.
/// Defines the basic properties of a text element.
/// </summary>
publicinterfaceIBaseText
{
/// <summary>
/// The text to display.
/// </summary>
stringText{get;set;}
/// <summary>
/// The target locale of the XML payload, specified as a BCP-47 language tags such as "en-US" or "fr-FR". The locale specified here overrides any other specified locale, such as that in binding or visual. If this value is a literal string, this attribute defaults to the user's UI language. If this value is a string reference, this attribute defaults to the locale chosen by Windows Runtime in resolving the string.
/// Set to true to allow Windows to append a query string to the image URI supplied in the Tile notification. Use this attribute if your server hosts images and can handle query strings, either by retrieving an image variant based on the query strings or by ignoring the query string and returning the image as specified without the query string. This query string specifies scale, contrast setting, and language; for instance, a value of
/// Set to a sender-defined string that uniquely identifies the content of the notification. This prevents duplicates in the situation where a large Tile template is displaying the last three wide Tile notifications.
///
/// Required: NO
/// </summary>
[NotificationXmlAttribute("contentId")]
publicstringContentId{get;set;}
/// <summary>
/// An optional string to override the Tile's display name while showing this notification.
/// </summary>
[NotificationXmlAttribute("displayName")]
publicstringDisplayName{get;set;}
/// <summary>
/// The target locale of the XML payload, specified as a BCP-47 language tags such as "en-US" or "fr-FR". The locale specified here overrides that in visual, but can be overriden by that in text. If this value is a literal string, this attribute defaults to the user's UI language. If this value is a string reference, this attribute defaults to the locale chosen by Windows Runtime in resolving the string. See Remarks for when this value isn't specified.
/// Elements that can be direct children of <see cref="TileBindingContentAdaptive"/>, including (<see cref="AdaptiveText"/>, <see cref="AdaptiveImage"/>, and <see cref="AdaptiveGroup"/>).
/// </summary>
publicinterfaceITileBindingContentAdaptiveChild
{
// Blank interface simply for compile-enforcing the child types in the list.
/// Supported on Small and Medium. Enables an iconic Tile template, where you can have an icon and badge display next to each other on the Tile, in true classic Windows Phone style. The number next to the icon is achieved through a separate badge notification.
/// At minimum, to support both Desktop and Phone, Small and Medium tiles, provide a square aspect ratio image with a resolution of 200x200, PNG format, with transparency and no color other than white. For more info see: http://blogs.msdn.com/b/tiles_and_toasts/archive/2015/07/31/iconic-tile-template-for-windows-10.aspx
/// Up to 12 images can be provided (Mobile will only display up to 9), which will be used for the slideshow. Adding more than 12 will throw an exception.
/// A full-bleed background image that appears beneath the Tile content.
/// </summary>
publicsealedclassTileBackgroundImage:IBaseImage
{
privatestring_source;
/// <summary>
/// The URI of the image. Can be from your application package, application data, or the internet. Internet images must be less than 200 KB in size.
/// </summary>
publicstringSource
{
get{return_source;}
set{BaseImageHelper.SetSource(ref_source,value);}
}
/// <summary>
/// A description of the image, for users of assistive technologies.
/// </summary>
publicstringAlternateText{get;set;}
/// <summary>
/// Set to true to allow Windows to append a query string to the image URI supplied in the Tile notification. Use this attribute if your server hosts images and can handle query strings, either by retrieving an image variant based on the query strings or by ignoring the query string and returning the image as specified without the query string. This query string specifies scale, contrast setting, and language.
/// </summary>
publicbool?AddImageQuery{get;set;}
privateint?_hintOverlay;
/// <summary>
/// A black overlay on the background image. This value controls the opacity of the black overlay, with 0 being no overlay and 100 being completely black. Defaults to 20.
/// An image used on various special templates for the Tile.
/// </summary>
publicsealedclassTileBasicImage:IBaseImage
{
privatestring_source;
/// <summary>
/// The URI of the image. Can be from your application package, application data, or the internet. Internet images must be less than 200 KB in size.
/// </summary>
publicstringSource
{
get{return_source;}
set{BaseImageHelper.SetSource(ref_source,value);}
}
/// <summary>
/// A description of the image, for users of assistive technologies.
/// </summary>
publicstringAlternateText{get;set;}
/// <summary>
/// Set to true to allow Windows to append a query string to the image URI supplied in the Tile notification. Use this attribute if your server hosts images and can handle query strings, either by retrieving an image variant based on the query strings or by ignoring the query string and returning the image as specified without the query string. This query string specifies scale, contrast setting, and language.
/// The text value that will be shown in the text field.
/// </summary>
publicstringText{get;set;}
/// <summary>
/// The target locale of the XML payload, specified as a BCP-47 language tags such as "en-US" or "fr-FR". The locale specified here overrides any other specified locale, such as that in binding or visual. If this value is a literal string, this attribute defaults to the user's UI language. If this value is a string reference, this attribute defaults to the locale chosen by Windows Runtime in resolving the string.
/// The binding element contains the visual content for a specific Tile size.
/// </summary>
publicsealedclassTileBinding
{
/// <summary>
/// The target locale of the XML payload, specified as a BCP-47 language tags such as "en-US" or "fr-FR". The locale specified here overrides that in visual, but can be overriden by that in text. If this value is a literal string, this attribute defaults to the user's UI language. If this value is a string reference, this attribute defaults to the locale chosen by Windows Runtime in resolving the string. See Remarks for when this value isn't specified.
/// </summary>
publicstringLanguage{get;set;}
/// <summary>
/// A default base URI that is combined with relative URIs in image source attributes. Defaults to null.
/// </summary>
publicUriBaseUri{get;set;}
/// <summary>
/// The form that the Tile should use to display the app's brand..
/// Defaults to false. Set to true to allow Windows to append a query string to the image URI supplied in the Tile notification. Use this attribute if your server hosts images and can handle query strings, either by retrieving an image variant based on the query strings or by ignoring the query string and returning the image as specified without the query string. This query string specifies scale, contrast setting, and language; for instance, a value of
/// Set to a sender-defined string that uniquely identifies the content of the notification. This prevents duplicates in the situation where a large Tile template is displaying the last three wide Tile notifications.
/// </summary>
publicstringContentId{get;set;}
/// <summary>
/// An optional string to override the Tile's display name while showing this notification.
/// </summary>
publicstringDisplayName{get;set;}
/// <summary>
/// New in Anniversary Update: App-defined data that is passed back to your app via the TileActivatedInfo property on LaunchActivatedEventArgs when the user launches your app from the Live Tile. This allows you to know which Tile notifications your user saw when they tapped your Live Tile. On devices without the Anniversary Update, this will simply be ignored.
/// </summary>
publicstringArguments{get;set;}
/// <summary>
/// The actual content to be displayed. One of <see cref="TileBindingContentAdaptive"/>, <see cref="TileBindingContentIconic"/>, <see cref="TileBindingContentContact"/>, <see cref="TileBindingContentPeople"/>, or <see cref="TileBindingContentPhotos"/>
/// Supported on all sizes. This is the recommended way of specifying your Tile content. Adaptive Tile templates are the de-facto choice for Windows 10, and you can create a wide variety of custom Tiles through adaptive.
/// <see cref="AdaptiveText"/>, <see cref="AdaptiveImage"/>, and <see cref="AdaptiveGroup"/> objects can be added as children. The children are displayed in a vertical StackPanel fashion.
/// Base Tile element, which contains a single visual element.
/// </summary>
publicsealedclassTileContent
{
/// <summary>
/// The visual element is required.
/// </summary>
publicTileVisualVisual{get;set;}
/// <summary>
/// Retrieves the notification XML content as a string, so that it can be sent with a HTTP POST in a push notification.
/// </summary>
/// <returns>The notification XML content as a string.</returns>
publicstringGetContent()
{
returnConvertToElement().GetContent();
}
#if WINDOWS_UWP
/// <summary>
/// Retrieves the notification XML content as a WinRT XmlDocument, so that it can be used with a local Tile notification's constructor on either <see cref="TileNotification"/> or <see cref="ScheduledTileNotification"/>.
/// </summary>
/// <returns>The notification XML content as a WinRT XmlDocument.</returns>
/// A peek image that animates in from the top of the Tile.
/// </summary>
publicsealedclassTilePeekImage:IBaseImage
{
privatestring_source;
/// <summary>
/// The URI of the image. Can be from your application package, application data, or the internet. Internet images must be less than 200 KB in size.
/// </summary>
publicstringSource
{
get{return_source;}
set{BaseImageHelper.SetSource(ref_source,value);}
}
/// <summary>
/// A description of the image, for users of assistive technologies.
/// </summary>
publicstringAlternateText{get;set;}
/// <summary>
/// Set to true to allow Windows to append a query string to the image URI supplied in the Tile notification. Use this attribute if your server hosts images and can handle query strings, either by retrieving an image variant based on the query strings or by ignoring the query string and returning the image as specified without the query string. This query string specifies scale, contrast setting, and language.
/// </summary>
publicbool?AddImageQuery{get;set;}
privateint?_hintOverlay;
/// <summary>
/// New in 1511: A black overlay on the peek image. This value controls the opacity of the black overlay, with 0 being no overlay and 100 being completely black. Defaults to 0.
/// Previously for RTM: Did not exist, value will be ignored and peek image will be displayed with 0 overlay.
/// Contains multiple binding child elements, each of which defines a Tile.
/// </summary>
publicsealedclassTileVisual
{
/// <summary>
/// The target locale of the XML payload, specified as a BCP-47 language tags such as "en-US" or "fr-FR". This locale is overridden by any locale specified in binding or text. If this value is a literal string, this attribute defaults to the user's UI language. If this value is a string reference, this attribute defaults to the locale chosen by Windows Runtime in resolving the string.
/// </summary>
publicstringLanguage{get;set;}
/// <summary>
/// A default base URI that is combined with relative URIs in image source attributes.
/// </summary>
publicUriBaseUri{get;set;}
/// <summary>
/// The form that the Tile should use to display the app's brand.
/// Defaults to false. Set to true to allow Windows to append a query string to the image URI supplied in the Tile notification. Use this attribute if your server hosts images and can handle query strings, either by retrieving an image variant based on the query strings or by ignoring the query string and returning the image as specified without the query string. This query string specifies scale, contrast setting, and language; for instance, a value of
/// Set to a sender-defined string that uniquely identifies the content of the notification. This prevents duplicates in the situation where a large Tile template is displaying the last three wide Tile notifications.
/// </summary>
publicstringContentId{get;set;}
/// <summary>
/// An optional string to override the Tile's display name while showing this notification.
/// </summary>
publicstringDisplayName{get;set;}
/// <summary>
/// If you specify this, you must also provide a Wide Tile binding. This is the first line of text that will be displayed on the lock screen if the user has selected your Tile as their detailed status app.
/// </summary>
publicstringLockDetailedStatus1{get;set;}
/// <summary>
/// If you specify this, you must also provide a Wide Tile binding. This is the second line of text that will be displayed on the lock screen if the user has selected your Tile as their detailed status app.
/// </summary>
publicstringLockDetailedStatus2{get;set;}
/// <summary>
/// If you specify this, you must also provide a Wide Tile binding. This is the third line of text that will be displayed on the lock screen if the user has selected your Tile as their detailed status app.
/// </summary>
publicstringLockDetailedStatus3{get;set;}
/// <summary>
/// New in Anniversary Update: App-defined data that is passed back to your app via the TileActivatedInfo property on LaunchActivatedEventArgs when the user launches your app from the Live Tile. This allows you to know which Tile notifications your user saw when they tapped your Live Tile. On devices without the Anniversary Update, this will simply be ignored.
/// </summary>
publicstringArguments{get;set;}
/// <summary>
/// Provide an optional small binding to specify content for the small Tile size.
/// </summary>
publicTileBindingTileSmall{get;set;}
/// <summary>
/// Provide an optional medium binding to specify content for the medium Tile size.
/// </summary>
publicTileBindingTileMedium{get;set;}
/// <summary>
/// Provide an optional wide binding to specify content for the wide Tile size.
/// </summary>
publicTileBindingTileWide{get;set;}
/// <summary>
/// Desktop-only. Provide an optional large binding to specify content for the large Tile size.
/// </summary>
publicTileBindingTileLarge{get;set;}
/// <summary>
/// Attempts to find and re-use an existing text element inside the binding. Returns true if it could. Otherwise returns false, and the caller will have to specify the detailed status using the lock hint attribute.
/// </summary>
/// <param name="lineNumber">The lock screen line number.</param>
/// <param name="lockText">The lock screen line text.</param>
/// <param name="binding">The binding to look in for matches.</param>
/// <returns>True if could re-use existing text element, otherwise false.</returns>
thrownewArgumentNullException("lockText cannot be null");
}
if(binding==null)
{
thrownewArgumentNullException("binding cannot be null");
}
// If a text element already has an id with the line number (only look at immediate children, since the lockscreen will ignore things under groups/subgroups)
// Otherwise if they specified lock values, throw an exception since lock values require wide
elseif(HasLockDetailedStatusValues())
{
thrownewException("To provide lock detailed status text strings, you must also provide a TileWide binding. Either provide a TileWide binding, or leave the detailed status values null.");
/// Default value. Toast appears for a short while and then goes into Action Center.
/// </summary>
Short,
/// <summary>
/// Toast stays on-screen for longer, and then goes into Action Center.
/// </summary>
[EnumString("long")]
Long
}
/// <summary>
/// Specifies the scenario, controlling behaviors about the Toast.
/// </summary>
publicenumToastScenario
{
/// <summary>
/// The normal Toast behavior. The Toast appears for a short duration, and then automatically dismisses into Action Center.
/// </summary>
Default,
/// <summary>
/// Causes the Toast to stay on-screen and expanded until the user takes action. Also causes a looping alarm sound to be selected by default.
/// </summary>
[EnumString("alarm")]
Alarm,
/// <summary>
/// Causes the Toast to stay on-screen and expanded until the user takes action.
/// </summary>
[EnumString("reminder")]
Reminder,
/// <summary>
/// Causes the Toast to stay on-screen and expanded until the user takes action (on Mobile this expands to full screen). Also causes a looping incoming call sound to be selected by default.
/// Default value. Your foreground app is launched.
/// </summary>
Foreground,
/// <summary>
/// Your corresponding background task (assuming you set everything up) is triggered, and you can execute code in the background (like sending the user's quick reply message) without interrupting the user.
/// </summary>
[EnumString("background")]
Background,
/// <summary>
/// Launch a different app using protocol activation.
/// The media file to play in place of the default sound. This can either be a ms-winsoundevent value, or a custom ms-appx:/// or ms-appdata:/// file, or null for the default sound.
/// </summary>
[NotificationXmlAttribute("src")]
publicUriSrc{get;set;}
[NotificationXmlAttribute("loop",DEFAULT_LOOP)]
publicboolLoop{get;set;}=DEFAULT_LOOP;
/// <summary>
/// True to mute the sound; false to allow the Toast notification sound to play.
/// Set to true to allow Windows to append a query string to the image URI supplied in the Tile notification. Use this attribute if your server hosts images and can handle query strings, either by retrieving an image variant based on the query strings or by ignoring the query string and returning the image as specified without the query string. This query string specifies scale, contrast setting, and language; for instance, a value of
/// A default base URI that is combined with relative URIs in image source attributes.
/// </summary>
[NotificationXmlAttribute("baseUri")]
publicUriBaseUri{get;set;}
/// <summary>
/// The target locale of the XML payload, specified as a BCP-47 language tags such as "en-US" or "fr-FR". The locale specified here overrides that in visual, but can be overriden by that in text. If this value is a literal string, this attribute defaults to the user's UI language. If this value is a string reference, this attribute defaults to the locale chosen by Windows Runtime in resolving the string. See Remarks for when this value isn't specified.
/// The id attribute is required and is for developers to retrieve user inputs once the app is activated (in the foreground or background).
/// </summary>
[NotificationXmlAttribute("id")]
publicstringId{get;set;}
[NotificationXmlAttribute("type")]
publicToastInputTypeType{get;set;}
/// <summary>
/// The title attribute is optional and is for developers to specify a title for the input for shells to render when there is affordance.
/// </summary>
[NotificationXmlAttribute("title")]
publicstringTitle{get;set;}
/// <summary>
/// The placeholderContent attribute is optional and is the grey-out hint text for text input type. This attribute is ignored when the input type is not �text�.
/// </summary>
[NotificationXmlAttribute("placeHolderContent")]
publicstringPlaceholderContent{get;set;}
/// <summary>
/// The defaultInput attribute is optional and it allows developer to provide a default input value.
/// Elements that can be direct children of <see cref="ToastBindingGeneric"/>, including (<see cref="AdaptiveText"/>, <see cref="AdaptiveImage"/>, and <see cref="AdaptiveGroup"/>).
/// </summary>
publicinterfaceIToastBindingGenericChild
{
// Blank interface simply for compile-enforcing the child types in the list.
/// Create your own custom actions, using controls like <see cref="ToastButton"/>, <see cref="ToastTextBox"/>, and <see cref="ToastSelectionBox"/>.
/// </summary>
publicsealedclassToastActionsCustom:IToastActions
{
/// <summary>
/// Inputs like <see cref="ToastTextBox"/> and <see cref="ToastSelectionBox"/> can be added to the Toast. Only up to 5 inputs can be added; after that, an exception is thrown.
/// Buttons are displayed after all the inputs (or adjacent to inputs if used as quick reply buttons). Only up to 5 buttons can be added (or fewer if you are also including context menu items). After that, an exception is thrown. You can add <see cref="ToastButton"/>, <see cref="ToastButtonSnooze"/>, or <see cref="ToastButtonDismiss"/>
/// New in Anniversary Update: Custom context menu items, providing additional actions when the user right clicks the Toast notification. You can only have up to 5 buttons and context menu items *combined*. Thus, if you have one context menu item, you can only have four buttons, etc.
/// Automatically constructs a selection box for snooze intervals, and snooze/dismiss buttons, all automatically localized, and snoozing logic is automatically handled by the system.
/// New in Anniversary Update: Custom context menu items, providing additional actions when the user right clicks the Toast notification. You can only have up to 5 items.
/// New in Creators Update: Additional options relating to activation.
/// </summary>
publicsealedclassToastActivationOptions
{
/// <summary>
/// If you are using <see cref="ToastActivationType.Protocol"/>, you can optionally specify the target PFN, so that regardless of whether multiple apps are registered to handle the same protocol uri, your desired app will always be launched.
/// New in Fall Creators Update: Specifies the behavior that the toast should use when the user invokes this action. Note that this option only works on <see cref="ToastButton"/> and <see cref="ToastContextMenuItem"/>. Desktop-only, supported in builds 16251 or higher.
/// Generic Toast binding, where you provide text, images, and other visual elements for your Toast notification.
/// </summary>
publicsealedclassToastBindingGeneric
{
/// <summary>
/// The contents of the body of the Toast, which can include <see cref="AdaptiveText"/>, <see cref="AdaptiveImage"/>, and <see cref="AdaptiveGroup"/> (added in Anniversary Update). Also, <see cref="AdaptiveText"/> elements must come before any other elements. If an <see cref="AdaptiveText"/> element is placed after any other element, an exception will be thrown when you try to retrieve the Toast XML content. And finally, certain <see cref="AdaptiveText"/> properties like HintStyle aren't supported on the root children text elements, and only work inside an <see cref="AdaptiveGroup"/>. If you use <see cref="AdaptiveGroup"/> on devices without the Anniversary Update, the group content will simply be dropped.
/// New in Anniversary Update: An optional hero image (a visually impactful image displayed on the Toast notification). On devices without the Anniversary Update, the hero image will simply be ignored.
/// </summary>
publicToastGenericHeroImageHeroImage{get;set;}
/// <summary>
/// New in Anniversary Update: An optional text element that is displayed as attribution text. On devices without the Anniversary Update, this text will appear as if it's another <see cref="AdaptiveText"/> element at the end of your Children list.
/// The target locale of the XML payload, specified as BCP-47 language tags such as "en-US" or "fr-FR". This locale is overridden by any locale specified in binding or text. If this value is a literal string, this attribute defaults to the user's UI language. If this value is a string reference, this attribute defaults to the locale chosen by Windows Runtime in resolving the string.
/// </summary>
publicstringLanguage{get;set;}
/// <summary>
/// A default base URI that is combined with relative URIs in image source attributes.
/// </summary>
publicUriBaseUri{get;set;}
/// <summary>
/// Set to "true" to allow Windows to append a query string to the image URI supplied in the Toast notification. Use this attribute if your server hosts images and can handle query strings, either by retrieving an image variant based on the query strings or by ignoring the query string and returning the image as specified without the query string. This query string specifies scale, contrast setting, and language.
/// A button that the user can click on a Toast notification.
/// </summary>
publicsealedclassToastButton:IToastButton
{
/// <summary>
/// Initializes a Toast button with the required properties.
/// </summary>
/// <param name="content">The text to display on the button.</param>
/// <param name="arguments">App-defined string of arguments that the app can later retrieve once it is activated when the user clicks the button.</param>
publicToastButton(stringcontent,stringarguments)
{
if(content==null)
{
thrownewArgumentNullException(nameof(content));
}
if(arguments==null)
{
thrownewArgumentNullException(nameof(arguments));
}
Content=content;
Arguments=arguments;
}
/// <summary>
/// Required. The text to display on the button.
/// </summary>
publicstringContent{get;privateset;}
/// <summary>
/// Required. App-defined string of arguments that the app can later retrieve once it is activated when the user clicks the button.
/// </summary>
publicstringArguments{get;privateset;}
/// <summary>
/// Controls what type of activation this button will use when clicked. Defaults to Foreground.
/// An optional image icon for the button to display (required for buttons adjacent to inputs like quick reply).
/// </summary>
publicstringImageUri{get;set;}
/// <summary>
/// Specify the ID of an existing <see cref="ToastTextBox"/> in order to have this button display to the right of the input, achieving a quick reply scenario.
Content=this.CustomContent==null?string.Empty:this.CustomContent,// If not using custom content, we need to provide empty string, otherwise Toast doesn't get displayed
/// A system-handled snooze button that automatically handles snoozing of a Toast notification.
/// </summary>
publicsealedclassToastButtonSnooze:IToastButton
{
/// <summary>
/// Custom text displayed on the button that overrides the default localized "Snooze" text.
/// </summary>
publicstringCustomContent{get;privateset;}
/// <summary>
/// An optional image icon for the button to display.
/// </summary>
publicstringImageUri{get;set;}
/// <summary>
/// Optionally specify the ID of an existing <see cref="ToastSelectionBox"/> in order to allow the user to pick a custom snooze time. The ID's of the <see cref="ToastSelectionBoxItem"/>s inside the selection box must represent the snooze interval in minutes. For example, if the user selects an item that has an ID of "120", then the notification will be snoozed for 2 hours. When the user clicks this button, if you specified a SelectionBoxId, the system will parse the ID of the selected item and snooze by that amount of minutes. If you didn't specify a SelectionBoxId, the system will snooze by the default system snooze time.
/// </summary>
publicstringSelectionBoxId{get;set;}
/// <summary>
/// Initializes a system-handled snooze button that displays localized "Snooze" text on the button and automatically handles snoozing.
/// </summary>
publicToastButtonSnooze()
{
}
/// <summary>
/// Initializes a system-handled snooze button that displays your text on the button and automatically handles snoozing.
/// </summary>
/// <param name="customContent">The text you want displayed on the button.</param>
/// Decides the type of activation that will be used when the user interacts with the Toast notification.
/// </summary>
publicenumToastActivationType
{
/// <summary>
/// Default value. Your foreground app is launched.
/// </summary>
Foreground,
/// <summary>
/// Your corresponding background task (assuming you set everything up) is triggered, and you can execute code in the background (like sending the user's quick reply message) without interrupting the user.
/// </summary>
[EnumString("background")]
Background,
/// <summary>
/// Launch a different app using protocol activation.
/// </summary>
[EnumString("protocol")]
Protocol
}
/// <summary>
/// Specifies the behavior that the toast should use when the user takes action on the toast.
/// </summary>
publicenumToastAfterActivationBehavior
{
/// <summary>
/// Default behavior. The toast will be dismissed when the user takes action on the toast.
/// </summary>
Default,
/// <summary>
/// After the user clicks a button on your toast, the notification will remain present, in a "pending update" visual state. You should immediately update your toast from a background task so that the user does not see this "pending update" visual state for too long.
/// Optionally create custom actions with buttons and inputs (using <see cref="ToastActionsCustom"/>) or optionally use the system-default snooze/dismiss controls (with <see cref="ToastActionsSnoozeAndDismiss"/>).
/// </summary>
publicIToastActionsActions{get;set;}
/// <summary>
/// New in Creators Update: Gets or sets an optional header for the toast notification.
/// </summary>
publicToastHeaderHeader{get;set;}
/// <summary>
/// Specify the scenario, to make the Toast behave like an alarm, reminder, or more.
/// </summary>
publicToastScenarioScenario{get;set;}
/// <summary>
/// The amount of time the Toast should display. You typically should use the Scenario attribute instead, which impacts how long a Toast stays on screen.
/// </summary>
publicToastDurationDuration{get;set;}
/// <summary>
/// A string that is passed to the application when it is activated by the Toast. The format and contents of this string are defined by the app for its own use. When the user taps or clicks the Toast to launch its associated app, the launch string provides the context to the app that allows it to show the user a view relevant to the Toast content, rather than launching in its default way.
/// </summary>
publicstringLaunch{get;set;}
/// <summary>
/// Specifies what activation type will be used when the user clicks the body of this Toast.
/// </summary>
publicToastActivationTypeActivationType{get;set;}
/// <summary>
/// New in Creators Update: Additional options relating to activation of the toast notification.
/// New in Creators Update: An optional custom time to use for the notification's timestamp, visible within Action Center. If provided, this date/time will be used on the notification instead of the date/time that the notification was received.
/// </summary>
publicDateTimeOffset?DisplayTimestamp{get;set;}
/// <summary>
/// Retrieves the notification XML content as a string, so that it can be sent with a HTTP POST in a push notification.
/// </summary>
/// <returns>The notification XML content as a string.</returns>
publicstringGetContent()
{
returnConvertToElement().GetContent();
}
#if WINDOWS_UWP
/// <summary>
/// Retrieves the notification XML content as a WinRT XmlDocument, so that it can be used with a local Toast notification's constructor on either <see cref="ToastNotification"/> or <see cref="ScheduledToastNotification"/>.
/// </summary>
/// <returns>The notification XML content as a WinRT XmlDocument.</returns>
thrownewInvalidOperationException("ToastContent does not support a custom AfterActivationBehavior. Please ensure ActivationOptions.AfterActivationBehavior is set to Default.");
}
}
DateTimeOffset?strippedDisplayTimestamp=null;
if(DisplayTimestamp!=null)
{
// We need to make sure we don't include more than 3 decimal points on seconds
// The Millisecond value itself is limited to 3 decimal points, thus by doing the following
// we bypass the more granular value that can come from Ticks and ensure we only have 3 decimals at most.
/// Initializes a Toast context menu item with the required properties.
/// </summary>
/// <param name="content">The text to display on the menu item.</param>
/// <param name="arguments">App-defined string of arguments that the app can later retrieve once it is activated when the user clicks the menu item.</param>
/// The logo that is displayed on your Toast notification.
/// </summary>
publicsealedclassToastGenericAppLogo:IBaseImage
{
/// <summary>
/// Initializes a logo that is displayed on your Toast notification.
/// </summary>
publicToastGenericAppLogo()
{
}
privatestring_source;
/// <summary>
/// The URI of the image. Can be from your application package, application data, or the internet. Internet images must be less than 200 KB in size.
/// </summary>
publicstringSource
{
get{return_source;}
set{BaseImageHelper.SetSource(ref_source,value);}
}
/// <summary>
/// A description of the image, for users of assistive technologies.
/// </summary>
publicstringAlternateText{get;set;}
/// <summary>
/// Set to true to allow Windows to append a query string to the image URI supplied in the Tile notification. Use this attribute if your server hosts images and can handle query strings, either by retrieving an image variant based on the query strings or by ignoring the query string and returning the image as specified without the query string. This query string specifies scale, contrast setting, and language.
/// </summary>
publicbool?AddImageQuery{get;set;}
/// <summary>
/// Specify how you would like the image to be cropped.
/// Initializes an attribution text element to be displayed on the Toast notification.
/// </summary>
publicToastGenericAttributionText()
{
}
/// <summary>
/// The text to display.
/// </summary>
publicstringText{get;set;}
/// <summary>
/// The target locale of the XML payload, specified as a BCP-47 language tags such as "en-US" or "fr-FR". The locale specified here overrides any other specified locale, such as that in binding or visual. If this value is a literal string, this attribute defaults to the user's UI language. If this value is a string reference, this attribute defaults to the locale chosen by Windows Runtime in resolving the string.
/// Initializes a hero image for the Toast notification.
/// </summary>
publicToastGenericHeroImage()
{
}
privatestring_source;
/// <summary>
/// The URI of the image. Can be from your application package, application data, or the internet. Internet images must be less than 200 KB in size.
/// </summary>
publicstringSource
{
get{return_source;}
set{BaseImageHelper.SetSource(ref_source,value);}
}
/// <summary>
/// A description of the image, for users of assistive technologies.
/// </summary>
publicstringAlternateText{get;set;}
/// <summary>
/// Set to true to allow Windows to append a query string to the image URI supplied in the Tile notification. Use this attribute if your server hosts images and can handle query strings, either by retrieving an image variant based on the query strings or by ignoring the query string and returning the image as specified without the query string. This query string specifies scale, contrast setting, and language.
/// Defines a visual header for the toast notification.
/// </summary>
publicsealedclassToastHeader
{
/// <summary>
/// Constructs a toast header with all the required properties.
/// </summary>
/// <param name="id">A developer-created identifier that uniquely identifies this header. If two notifications have the same header id, they will be displayed underneath the same header in Action Center.</param>
/// <param name="title">A title for the header.</param>
/// <param name="arguments">A developer-defined string of arguments that is returned to the app when the user clicks this header.</param>
/// Gets or sets a developer-created identifier that uniquely identifies this header. If two notifications have the same header id, they will be displayed underneath the same header in Action Center. Cannot be null.
/// Gets or sets the type of activation this header will use when clicked. Defaults to Foreground. Note that only Foreground and Protocol are supported.
/// </summary>
publicToastActivationTypeActivationType
{
get
{
return_activationType;
}
set
{
switch(value)
{
caseToastActivationType.Foreground:
caseToastActivationType.Protocol:
_activationType=value;
break;
default:
thrownewArgumentException($"ActivationType of {value} is not supported on ToastHeader.");
}
}
}
/// <summary>
/// New in Creators Update: Additional options relating to activation of the toast header.
thrownewInvalidOperationException("ToastHeader does not support a custom AfterActivationBehavior. Please ensure ActivationOptions.AfterActivationBehavior is set to Default.");
/// A selection box control, which lets users pick from a dropdown list of options.
/// </summary>
publicsealedclassToastSelectionBox:IToastInput
{
/// <summary>
/// Initializes a new Toast SelectionBox input control with the required elements.
/// </summary>
/// <param name="id">Developer-provided ID that the developer uses later to retrieve input when the Toast is interacted with.</param>
publicToastSelectionBox(stringid)
{
if(id==null)
{
thrownewArgumentNullException(nameof(id));
}
Id=id;
}
/// <summary>
/// The ID property is required, and is used so that developers can retrieve user input once the app is activated.
/// </summary>
publicstringId{get;privateset;}
/// <summary>
/// Title text to display above the SelectionBox.
/// </summary>
publicstringTitle{get;set;}
/// <summary>
/// This controls which item is selected by default, and refers to the Id property of <see cref="ToastSelectionBoxItem"/>. If you do not provide this, the default selection will be empty (user sees nothing).
/// </summary>
publicstringDefaultSelectionBoxItemId{get;set;}
/// <summary>
/// The selection items that the user can pick from in this SelectionBox. Only 5 items can be added.
/// Defines the visual aspects of a Toast notification.
/// </summary>
publicsealedclassToastVisual
{
/// <summary>
/// The target locale of the XML payload, specified as BCP-47 language tags such as "en-US" or "fr-FR". This locale is overridden by any locale specified in binding or text. If this value is a literal string, this attribute defaults to the user's UI language. If this value is a string reference, this attribute defaults to the locale chosen by Windows Runtime in resolving the string.
/// </summary>
publicstringLanguage{get;set;}
/// <summary>
/// A default base URI that is combined with relative URIs in image source attributes.
/// </summary>
publicUriBaseUri{get;set;}
/// <summary>
/// Set to "true" to allow Windows to append a query string to the image URI supplied in the Toast notification. Use this attribute if your server hosts images and can handle query strings, either by retrieving an image variant based on the query strings or by ignoring the query string and returning the image as specified without the query string. This query string specifies scale, contrast setting, and language.
/// </summary>
publicbool?AddImageQuery{get;set;}
/// <summary>
/// The generic Toast binding, which can be rendered on all devices. This binding is required and cannot be null.
<RuleSet Name="Microsoft Managed Recommended Rules" Description="These rules focus on the most critical problems in your code, including potential security holes, application crashes, and other important logic and design errors. It is recommended to include this rule set in any custom rule set you create for your projects." ToolsVersion="14.0">