### SplitButton Example
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/custom-controls.md
An example of how to implement a SplitButton with a ContextMenu in XAML.
```xml
```
--------------------------------
### Assigning Colors and Brushes
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/colors-and-brushes.md
Examples of how to assign colors and brushes using ComponentResourceKeys in XAML.
```xml
Color color = "{DynamicResource {x:Static adonisUi:Colors.Layer1BackgroundColor}}"
Background brush = "{DynamicResource {x:Static adonisUi:Brushes.Layer1BackgroundBrush}}"
```
--------------------------------
### Switching Color Schemes at Runtime
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/colors-and-brushes.md
Example of how to switch between light and dark color schemes using ResourceLocator.
```csharp
private bool _isDark;
private void ChangeTheme(object sender, RoutedEventArgs e)
{
ResourceLocator.SetColorScheme(Application.Current.Resources, _isDark ? ResourceLocator.LightColorScheme : ResourceLocator.DarkColorScheme);
_isDark = !_isDark;
}
```
--------------------------------
### Localized Button Labels Example
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/message-box.md
C# code example demonstrating how to provide custom, localized labels for MessageBoxButtons.
```csharp
var messageBox = new MessageBoxModel
{
Text = "Hallo welt!",
Buttons = MessageBoxButtons.YesNoCancel("Ja", "Nein", "Abbrechen"),
};
MessageBox.Show(messageBox);
```
--------------------------------
### Watermark Example
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/watermark.md
Example of setting a watermark on a TextBox control using AdonisUI.Extensions.WatermarkExtension.
```xml
```
--------------------------------
### Override named resources
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/getting-started/configuration.md
This example shows how to override named resources like colors and dimensions.
```xml
#0BAC0821
```
--------------------------------
### ContentControl Template Usage
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/styles-and-templates.md
Example of using a ContentControl to display a loading circle template.
```xml
```
--------------------------------
### Using Loading Circle Template
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/loading.md
Example of how to apply the `LoadingCircle` DataTemplate to a `ContentControl` for a loading indicator.
```xml
```
--------------------------------
### Switching Custom Color Schemes
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/colors-and-brushes.md
Example of how to switch between two custom color schemes using ResourceLocator, specifying the URIs for both.
```csharp
Uri replacedColorSchemeUri = new Uri("pack://application:,,,/MyApp;component/ColorSchemes/CustomColorScheme1.xaml", UriKind.Absolute)
Uri replacingColorSchemeUri = new Uri("pack://application:,,,/MyApp;component/ColorSchemes/CustomColorScheme2.xaml", UriKind.Absolute)
AdonisUI.ResourceLocator.SetColorScheme(Application.Current.Resources, replacingColorSchemeUri, replacedColorSchemeUri);
```
--------------------------------
### MainWindow Constructor Example
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/space.md
Shows a practical implementation of setting the space resource owner fallback in a WPF MainWindow constructor.
```csharp
public partial class MainWindow : Window
{
public MainWindow()
{
AdonisUI.SpaceExtension.SetSpaceResourceOwnerFallback(this);
InitializeComponent();
}
}
```
--------------------------------
### Enabling PlaceTitleBarOverContent
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/window.md
Example of an AdonisWindow with the PlaceTitleBarOverContent property set to True, and binding TitleBarActualHeight for margins.
```xml
Sidebar contentMain content
```
--------------------------------
### Override default styles
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/getting-started/configuration.md
This example demonstrates how to override default styles for control types, such as changing the border thickness of all buttons.
```xml
```
--------------------------------
### Button Style Usage
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/styles-and-templates.md
Example of how to reference and apply an accent button style using ComponentResourceKeys.
```xml
```
--------------------------------
### Switching Color Schemes at Runtime
Source: https://github.com/benruehl/adonis-ui/blob/master/README.md
C# code example for switching color schemes at runtime using ResourceLocator.
```csharp
AdonisUI.ResourceLocator.SetColorScheme(Application.Current.Resources, ResourceLocator.DarkColorScheme);
```
--------------------------------
### Overriding Accent Color
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/colors-and-brushes.md
Example of overriding the default accent color in App.xaml.
```xml
#0BAC08
```
--------------------------------
### Progress Bar with Content Template
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/loading.md
An advanced example showing how to use `ContentTemplate` for complex content within a progress bar, including dynamic foreground and progress animation colors.
```xml
```
--------------------------------
### Layer property
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/layers.md
Example of how to use the Layer property on a GroupBox to force it to a specific layer.
```xml
```
--------------------------------
### Defining a New Custom Color Scheme
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/colors-and-brushes.md
Example of defining a new custom color scheme by creating a ResourceDictionary and assigning colors and brushes.
```xml
#0BAC08
```
--------------------------------
### Quick start usage of MessageBox.Show()
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/message-box.md
Demonstrates the basic usage of Adonis UI's MessageBox.Show() method, similar to the default System.Windows.MessageBox.Show().
```csharp
using AdonisUI.Controls;
MessageBox.Show("Hello world!");
MessageBox.Show("Hello world!", "Info", MessageBoxButton.OKCancel, MessageBoxImage.Information);
```
--------------------------------
### IncreaseLayer property
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/layers.md
Example of how to use the IncreaseLayer property on a GroupBox to make it represent a different layer.
```xml
```
--------------------------------
### Disable Progress Bar Animation
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/loading.md
Example of how to disable the ripple animation on a determinate progress bar.
```xml
```
--------------------------------
### Customizing a Shipped Color Scheme
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/colors-and-brushes.md
Example of customizing a shipped color scheme by merging it and overriding specific resources.
```xml
Green
```
--------------------------------
### Customizing Default Space Values
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/space.md
Provides an example of how to override the default horizontal and vertical space base values in application resources.
```xml
88
```
--------------------------------
### Set Corner Radius on Individual Control
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/dimensions.md
Example of setting the CornerRadius on an individual Button control using the CornerRadiusExtension.
```xml
```
--------------------------------
### Override Dimensions
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/dimensions.md
Example of overriding default dimensions like CornerRadius and BorderThickness in the application's resources.
```xml
21
```
--------------------------------
### Applying Space to Row Definitions
Source: https://github.com/benruehl/adonis-ui/blob/master/README.md
Examples of how to use the adonisUi:Space markup extension to define row heights, including calculations.
```xml
```
--------------------------------
### Disable Shrinking Title Bar
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/window.md
This example shows how to disable the shrinking of the title bar when the window is maximized by setting ShrinkTitleBarWhenMaximized to False.
```xml
```
--------------------------------
### Custom Title Bar Content
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/window.md
This example shows how to add custom content, such as a help button, to the title bar of an AdonisWindow.
```xml
```
--------------------------------
### Validation message placement customization
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/data-validation.md
Example of how to set the placement of the error message popup to be below the error icon.
```xml
```
--------------------------------
### Setting Cursor Spotlight Size on a Window
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/cursor-spotlight.md
Example of how to set the relative spotlight size for a specific window, which will be inherited by its children, using the CursorSpotlightExtension.
```xml
```
--------------------------------
### Ripple effect duration customization
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/ripple.md
Example of customizing the fade-in and fade-out durations for the ripple effect on a Button using RippleExtension.
```xml
```
--------------------------------
### Customizing Cursor Spotlight Colors
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/cursor-spotlight.md
Example of how to customize the background and border brush of the Cursor Spotlight for a Button using the CursorSpotlightExtension.
```xml
```
--------------------------------
### Processing the result of an advanced message box
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/message-box.md
Provides an example of how to handle the result from a message box that includes custom buttons.
```csharp
switch (messageBox.Result)
{
case MessageBoxResult.Yes:
ApplyAllExtras();
break;
case MessageBoxResult.Custom:
if (messageBox.ButtonPressed.Id == CHEESE_BUTTON_ID)
ApplyExtraCheese();
else if (messageBox.ButtonPressed.Id == BACON_BUTTON_ID)
ApplyExtraBacon();
break;
}
```
--------------------------------
### Validation message popup customization
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/data-validation.md
Example of how to enable/disable error message popups on focus and mouse over using ValidationExtension.
```xml
```
--------------------------------
### Customizing Maximum Blur Radius
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/cursor-spotlight.md
Example of how to change the maximum blur radius for the spotlight ellipse using the CursorSpotlightExtension on a Window.
```xml
```
--------------------------------
### Ripple effect colors customization
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/ripple.md
Example of customizing the background, border, and foreground brushes for the ripple effect on a Button using RippleExtension.
```xml
```
--------------------------------
### Applying Cursor Spotlight to Custom Controls
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/cursor-spotlight.md
Example of how to apply the Cursor Spotlight effect to a Border control by setting the MouseEventSource property of the CursorSpotlightExtension.
```xml
```
--------------------------------
### Custom MessageBoxWindow Style
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/message-box.md
Example XAML style to customize the MessageBoxWindow, including properties like MaxRelativeScreenWidth, MaxRelativeScreenHeight, ButtonStyle, CheckBoxStyle, and ButtonContainerStyle.
```xml
```
--------------------------------
### Overriding Global Cursor Spotlight Size
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/cursor-spotlight.md
Example of how to override the global Cursor Spotlight relative size in App.xaml by assigning a new value to the Dimensions.CursorSpotlightRelativeSize key.
```xml
0.75
```
--------------------------------
### Window Style
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/getting-started/introduction.md
Derive your window's style from the default style of Adonis UI.
```xml
```
--------------------------------
### App.xaml Resources
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/getting-started/introduction.md
Add resources to your application in your App.xaml.
```xml
```
--------------------------------
### Progress Bar with Direct Content
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/loading.md
Demonstrates using the `Content` property to display text directly on a progress bar, with automatic foreground adjustment.
```xml
```
--------------------------------
### Setting Space Resource Owner Fallback in C#
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/space.md
Demonstrates the C# code required to manually set the resource owner fallback when Adonis UI resources are not included globally.
```csharp
AdonisUI.SpaceExtension.SetSpaceResourceOwnerFallback(resourceOwner);
```
--------------------------------
### Navigation Generation Logic
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/_includes/nav.html
This snippet demonstrates the Liquid templating logic used to iterate through navigation items and generate markdown links.
```html
{%-
assign nav_list = site.data.nav.items -%}
{%- for node in nav_list -%}
* {%- assign page_url_segments = page.url | split: "/" -%}
{%- assign node_url_segments = node.url | split: "/" -%}
[{{ node.title }}]({{ site.baseurl }}{{ node.url }})
{%- endfor -%}
```
--------------------------------
### Space Usage for Thickness Properties
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/space.md
Shows how to apply spacing to thickness properties like Margin using the `adonisUi:Space` markup extension.
```xml
```
--------------------------------
### Navigation Generation Logic
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/_includes/nav-docs.html
This Liquid template code iterates through site pages, sorting them by 'nav_order', and generates a hierarchical navigation structure. It handles first, second, and third-level navigation items based on parent-child relationships and highlights the current page.
```html
{%-
assign pages_list = site.html_pages | sort:"nav_order" -%}
{%- for node in pages_list -%}
{%- unless node.nav_exclude -%}
{%- if node.parent == nil -%}
* {%- if page.parent == node.title or page.grand_parent == node.title -%}
{%- assign first_level_url = node.url | absolute_url -%}
{%- endif -%}
[{{ node.title }}]({{ node.url | absolute_url }})
{%- if node.has_children -%}
{%- assign children_list = site.html_pages | where: "parent", node.title | sort:"nav_order" -%}
{%- for child in children_list -%}
* {%- if page.url == child.url or page.parent == child.title -%}
{%- assign second_level_url = child.url | absolute_url -%}
{%- endif -%}
[{{ child.title }}]({{ child.url | absolute_url }})
{%- if child.has_children -%}
{%- assign grand_children_list = site.html_pages | where: "parent", child.title | sort:"nav_order" -%}
{%- for grand_child in grand_children_list -%}
* [{{ grand_child.title }}]({{ grand_child.url | absolute_url }})
{%- endfor -%}
{%- endif -%}
{%- endfor -%}
{%- endif -%}
{%- endif -%}
{%- endunless -%}
{%- endfor -%}
```
--------------------------------
### Manual Orientation Specification
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/space.md
Illustrates how to manually specify the orientation (Vertical/Horizontal) when the system cannot infer it.
```xml
```
--------------------------------
### Space Usage in RowDefinition
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/space.md
Demonstrates how to use the `adonisUi:Space` markup extension to define row heights with a base spacing value.
```xml
```
--------------------------------
### Advanced usage with MessageBoxModel
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/message-box.md
Shows how to use MessageBoxModel for more detailed control over the message box's properties and behavior.
```csharp
using AdonisUI.Controls;
var messageBox = new MessageBoxModel
{
Text = "Hello world!",
Caption = "Info",
Icon = MessageBoxImage.Information,
Buttons = MessageBoxButtons.OkCancel(),
};
MessageBox.Show(messageBox);
```
--------------------------------
### Liquid Template for Feature Cards
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/_includes/feature-cards.html
This snippet demonstrates how to iterate through a list of features and their details to generate a structured output, likely for display on a webpage.
```liquid
{%-
assign feature_list = site.data.features.items -%}
{%- for feature in feature_list -%}
### {{ feature.title }}
{%- assign feature_details_list = feature.items -%}
{%- for feature_detail in feature_details_list -%}
* {% if feature_detail.url != nil %} [{{ feature_detail.title }}]({{ feature_detail.url }}) {% else %} {{ feature_detail.title }} {% endif %}
{%- endfor -%}
{%- endfor -%}
```
--------------------------------
### Highly advanced usage with custom buttons and checkboxes
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/message-box.md
Illustrates a complex scenario with custom button labels, custom buttons, checkboxes, and disabling the opening sound.
```csharp
using AdonisUI.Controls;
const string CHEESE_BUTTON_ID = "cheese";
const string BACON_BUTTON_ID = "bacon";
var messageBox = new MessageBoxModel
{
Text = "Would you like to apply some extras?",
Caption = "Extra cheese maybe?",
Icon = MessageBoxImage.Question,
Buttons = new []
{
MessageBoxButtons.Yes("Yes, all you have!"),
MessageBoxButtons.Custom("Extra cheese", CHEESE_BUTTON_ID),
MessageBoxButtons.Custom("Extra bacon", BACON_BUTTON_ID),
MessageBoxButtons.No("No, no extras"),
MessageBoxButtons.Cancel(),
},
CheckBoxes = new []
{
new MessageBoxCheckBoxModel("Apply to all items of the order")
{
IsChecked = true,
Placement = MessageBoxCheckBoxPlacement.BelowText,
},
},
IsSoundEnabled = false,
};
MessageBox.Show(messageBox);
```
--------------------------------
### Jekyll Loop for Expo Projects
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/_includes/nav-expo.html
This snippet iterates through the 'expo' site data, sorts it by 'order', and generates a list of links to each project. It creates anchor links based on the project name.
```html
{%- assign exhibits = site.expo | sort:"order" -%} {%- for exhibit in exhibits -%}* [{{ exhibit.name }}](#{{ exhibit.name | relative_url | split: '/' | last | replace: ' ', '-' }})
{%- endfor -%}
```
--------------------------------
### Placement Customization for ScrollViewers
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/scrollbars.md
Configures the vertical and horizontal scroll bar placement for a ScrollViewer to 'Overlay'.
```xml
```
--------------------------------
### Expansion Mode Customization for ScrollBars
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/scrollbars.md
Customizes the expansion mode for a ScrollBar element.
```xml
```
--------------------------------
### Expansion Mode Customization for ScrollViewers
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/scrollbars.md
Customizes the vertical and horizontal scroll bar expansion modes for a ScrollViewer.
```xml
```
--------------------------------
### Application-wide Default ScrollBar Expansion Mode
Source: https://github.com/benruehl/adonis-ui/blob/master/docs/docs/guides/scrollbars.md
Overrides the default scroll bar style to set the expansion mode for the entire application.
```xml
```