Miscellaneous markup reference
Timer, style sheet, command, application builder, design-time size, Ref, and Apply.
Any type
Section titled “Any type”Receiver: any type.
| Method | Sets | Summary |
|---|---|---|
Apply(Action<T> action) |
Applies an action to the object. | |
Ref(out T field) |
Captures a reference to the object. |
ApplicationBuilder
Section titled “ApplicationBuilder”Receiver: ApplicationBuilder.
| Method | Sets | Summary |
|---|---|---|
BuildMainWindow(Func<Window> factory) |
Sets the main window factory. | |
OnStartup(Action startup) |
event Startup |
Sets the callback invoked on the UI thread after the dispatcher is installed and before the main window is shown. |
OnStartup(Action<string[]> startup) |
event Startup |
Sets the callback invoked with the command-line arguments on the UI thread after the dispatcher is installed and before the main window is shown. |
ThrowPlatformNotSupported(string message = null) |
Throws a PlatformNotSupportedException with an optional custom message. | |
UseAccent(Accent accent) |
Sets the default accent. | |
UseAccent(Color accentColor) |
Sets the default accent to a custom color. | |
UseMetrics(ThemeMetrics metrics) |
Sets the theme metric overrides. | |
UseSeed(ThemeSeed lightSeed, ThemeSeed darkSeed) |
Sets the seed palettes used to generate light/dark themes. | |
UseTheme(ThemeVariant themeMode) |
Sets the default theme mode. | |
WithShutdownMode(ShutdownMode shutdownMode) |
Sets when the run loop ends automatically as windows close. |
Command
Section titled “Command”Receiver: Command.
| Method | Sets | Summary |
|---|---|---|
BindDescription(ObservableValue<string> source) |
bind Description |
Binds the command’s description to an observable source. |
BindIcon(ObservableValue<IconTemplate> source) |
bind Icon |
Binds the command’s default icon presentation to an observable source. |
BindText(ObservableValue<string> source) |
bind Text |
Binds the command’s default presentation text to an observable source. |
Description(string description) |
Description |
Sets the sentence saying what running the command does. Material a presenter may use; a tooltip built from a command carries it when the presenter asks for it. |
DispatcherTimer
Section titled “DispatcherTimer”Receiver: DispatcherTimer.
| Method | Sets | Summary |
|---|---|---|
Interval(TimeSpan interval) |
Interval |
Sets the timer interval. |
IntervalMs(int milliseconds) |
Sets the timer interval in milliseconds. | |
OnTick(Action handler) |
event Tick |
Adds a tick event handler. |
Start() |
Starts the timer. | |
Stop() |
Stops the timer. |
StyleSheet
Section titled “StyleSheet”Receiver: StyleSheet.
| Method | Sets | Summary |
|---|---|---|
With(Style style) |
Defines a type-based style rule (Define) and returns the sheet for chaining. | |
With(string name, Func<Style> factory) |
Defines a named style through a factory invoked on first lookup (Define) and returns the sheet for chaining. | |
WithName(string styleName) |
Defines a type-based style rule by style name (Define) and returns the sheet for chaining. |
TrayIcon
Section titled “TrayIcon”Receiver: TrayIcon.
| Method | Sets | Summary |
|---|---|---|
Command(Command value) |
Command |
Sets Command. The command the icon runs when activated. |
CommandData(object value) |
CommandData |
Sets CommandData. The value passed to Command as its invocation argument. |
ContextMenu(ContextMenu value) |
ContextMenu |
Sets ContextMenu. The menu the icon opens; null for an icon without a menu. |
Icon(IconSource value) |
Icon |
Sets Icon. The icon image; null shows the application’s own icon. |
IsMonochromeIcon(bool value = true) |
IsMonochromeIcon |
Sets IsMonochromeIcon. Whether the icon is a single-color glyph that the platform may tint to match its status bar. |
IsVisible(bool value = true) |
IsVisible |
Sets IsVisible. Whether the icon is shown; false by default. |
OnClick(Action<TrayIconEventArgs> handler) |
event Click |
Subscribes handler to Click. Occurs when the platform reports a primary activation of the icon apart from opening its menu. |
OnDoubleClick(Action<TrayIconEventArgs> handler) |
event DoubleClick |
Subscribes handler to DoubleClick. Occurs on a double click where the platform reports one; its clicks raise Click as well. |
OnMenuOpening(Action handler) |
event MenuOpening |
Subscribes handler to MenuOpening. Occurs just before the menu opens; a handler may replace or fill ContextMenu. |
ToolTipText(string value) |
ToolTipText |
Sets ToolTipText. The text shown when the pointer rests on the icon. |
FrameworkElement
Section titled “FrameworkElement”Receiver: FrameworkElement and derived types (where T : FrameworkElement).
| Method | Sets | Summary |
|---|---|---|
DesignHeight(double height) |
Sets the preferred preview height for this element. A no-op outside preview sessions. | |
DesignSize(double width, double height) |
Sets the preferred preview size for this element. A no-op outside preview sessions. | |
DesignWidth(double width) |
Sets the preferred preview width for this element. A no-op outside preview sessions. |