### WPF Ribbon Gallery Example
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/bars/controls/gallery.md
Shows how to configure a RibbonGallery within a WPF RibbonTabItem. Requires Actipro WPF Bars and Themes namespaces.
```xaml
xmlns:bars="http://schemas.actiprosoftware.com/winfx/xaml/bars"
xmlns:themes="http://schemas.actiprosoftware.com/winfx/xaml/themes"
...
...
...
```
--------------------------------
### Avalonia Ribbon Gallery Example
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/bars/controls/gallery.md
Demonstrates how to define a RibbonGallery within an Avalonia RibbonTabItem. Requires Actipro Avalonia UI namespace.
```xaml
xmlns:actipro="http://schemas.actiprosoftware.com/avaloniaui"
...
...
...
```
--------------------------------
### WPF Menu Heading Example
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/bars/controls/heading.md
Demonstrates how to use BarMenuHeading within a BarContextMenu in WPF. Requires the Actipro WPF Bars namespace.
```xaml
xmlns:bars="http://schemas.actiprosoftware.com/winfx/xaml/bars"
...
...
```
--------------------------------
### Configure Help Button with Callback (Avalonia)
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/fundamentals/user-prompt/user-prompt-buttons.md
Use the WithHelpCommand method to configure a Help button that executes a custom action when clicked. This example shows configuration for Avalonia.
```csharp
await UserPromptBuilder.Configure()
// ... other configuration options here
.WithHelpCommand(() => OpenHelp())
.Show();
```
--------------------------------
### Avalonia Menu Heading Example
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/bars/controls/heading.md
Demonstrates how to use BarMenuHeading within a BarMenuFlyout in Avalonia. Requires the Actipro Avalonia UI namespace.
```xaml
xmlns:actipro="http://schemas.actiprosoftware.com/avaloniaui"
...
...
```
--------------------------------
### Configure Help Button with Callback (WPF)
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/fundamentals/user-prompt/user-prompt-buttons.md
Use the WithHelpCommand method to configure a Help button that executes a custom action when clicked. This example shows configuration for WPF.
```csharp
UserPromptBuilder.Configure()
// ... other configuration options here
.WithHelpCommand(() => OpenHelp())
.Show();
```
--------------------------------
### Basic QR Code Usage
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/data-visualization/barcodes/qr-code-symbologies.md
Demonstrates the basic setup for displaying a QR Code using BarcodePresenter and QrCodeSymbology. Ensure QrCodeSymbology is defined in resources.
```xaml
xmlns:actipro="http://schemas.actiprosoftware.com/avaloniaui"
...
...
```
--------------------------------
### ModernTheme with Native ColorPicker and DataGrid
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/themes/getting-started.md
Include styles for Actipro's ColorPicker and DataGrid NuGet packages. This example excludes Actipro Pro controls.
```xaml
```
--------------------------------
### Dock Tool Window to Top of Target
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/docking/docking-window-features/lifecycle-and-docking-management.md
Docks the 'solutionExplorerToolWindow' to the top of the 'propertiesToolWindow'. This example demonstrates docking a tool window to a specific side of another window.
```csharp
solutionExplorerToolWindow.Dock(propertiesToolWindow, Dock.Top);
```
```csharp
solutionExplorerToolWindow.Dock(propertiesToolWindow, Side.Top);
```
--------------------------------
### Programmatically Start Drag on Tool Window (WPF)
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/docking/docking-window-features/lifecycle-and-docking-management.md
Call DragMove on a DockingWindow instance to programmatically start a drag operation. An InputPointerButtonEventArgs must be passed to capture the related pointer. This can be called on windows not currently selected or in auto-hide state.
```csharp
private void OnControlMouseDown(object sender, MouseButtonEventArgs e) {
window.DragMove(new InputPointerButtonEventArgs(e, InputPointerButtonKind.Primary));
}
```
--------------------------------
### Programmatically Start Drag on Tool Window (Avalonia)
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/docking/docking-window-features/lifecycle-and-docking-management.md
Call DragMove on a DockingWindow instance to programmatically start a drag operation. The PointerPressedEventArgs must be passed to capture the related pointer. This can be called on windows not currently selected or in auto-hide state.
```csharp
private void OnControlPointerPressed(object sender, PointerPressedEventArgs e) {
window.DragMove(e);
}
```
--------------------------------
### Implement Live Preview Command
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/bars/controls/gallery.md
This command demonstrates how to set up live preview functionality for a gallery. It uses PreviewableDelegateCommand to handle preview start, execution, and cancellation actions, allowing temporary visual feedback to the user.
```csharp
public ICommand SetFontSizeCommand {
get {
if (setFontSizeCommand is null) {
setFontSizeCommand = new PreviewableDelegateCommand(
executeAction: p => {
OnRequestSaveAndExitPreviewMode();
UpdateSelectionTextStyle(x => x.FontSize = p?.Size ?? FontSettings.DefaultFontSize);
},
canExecuteFunc: p => true,
previewAction: p => {
OnRequestActivatePreviewMode();
UpdateSelectionTextStyle(x => x.FontSize = p?.Size ?? FontSettings.DefaultFontSize);
},
cancelPreviewAction: p => {
OnRequestCancelPreviewMode();
}
);
}
return setFontSizeCommand;
}
}
```
--------------------------------
### Set UserPromptWindow Startup Location (Avalonia)
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/fundamentals/user-prompt/display-and-results.md
Demonstrates how to set the WindowStartupLocation to CenterOwner for a UserPromptWindow using the ShowDialog method in Avalonia.
```csharp
var userPromptControl = new UserPromptControl() { ... };
Window owner = null; // Use default
await UserPromptWindow.ShowDialog(
userPromptControl,
"Window Title",
owner,
window => {
window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
});
```
--------------------------------
### Example SplitContainer XAML (WPF)
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/docking/layout-features/programmatic-layout.md
Demonstrates the XAML structure for a SplitContainer with two TabbedMdiContainers in WPF.
```xaml
```
--------------------------------
### Example SplitContainer XAML (Avalonia)
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/docking/layout-features/programmatic-layout.md
Demonstrates the XAML structure for a SplitContainer with two TabbedMdiContainers in Avalonia.
```xaml
```
--------------------------------
### Initialize Hosting Window for Dialogs (Avalonia)
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/fundamentals/user-prompt/builder-pattern.md
When displaying a prompt as a dialog in Avalonia, use AfterInitializeWindow to finalize the hosting UserPromptWindow after its initial configuration.
```csharp
var result = await UserPromptBuilder.Configure()
// ... other configuration options here
.AfterInitializeWindow(window => {
// Define logic here
})
.Show();
```
--------------------------------
### ModernTheme with All Actipro Styles
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/themes/getting-started.md
Include styles for all available Actipro assemblies and NuGet packages. This is a comprehensive setup.
```xaml
```
--------------------------------
### Create a PreviewableDelegateCommand
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/bars/controls/using-commands.md
Use PreviewableDelegateCommand to implement execute, can-execute, and live preview logic for actions like applying text styles. It supports starting and canceling preview actions.
```csharp
var setTextStyleCommand = new PreviewableDelegateCommand(
executeAction: p => {
currentDocument?.ApplyTextStyle(p);
},
canExecuteFunc: p => currentDocument != null,
previewAction: p => {
currentDocument?.StartPreviewMode();
currentDocument?.ApplyTextStyle(p);
},
cancelPreviewAction: p => {
currentDocument?.CancelPreviewMode();
}
);
```
--------------------------------
### Create Custom Button with Label (WPF)
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/fundamentals/user-prompt/user-prompt-buttons.md
Use the `UserPromptButtonBuilder` to create a button with a custom label. This example is for WPF.
```csharp
UserPromptBuilder.Configure()
// ... other configuration options here
.WithButton(_ => _
.WithResult(UserPromptStandardResult.Ignore)
.WithContent("Continue")
)
.Show();
```
--------------------------------
### Use DynamicImage for Dark Theme Adaptation
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/themes/image-provider.md
An example of using the DynamicImage control in XAML. Ensure the necessary xmlns is included.
```xaml
xmlns:actipro="http://schemas.actiprosoftware.com/avaloniaui"
...
```
--------------------------------
### Set UserPromptWindow Startup Location (WPF)
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/fundamentals/user-prompt/display-and-results.md
Demonstrates how to set the WindowStartupLocation to CenterOwner for a UserPromptWindow using the ShowDialog method in WPF.
```csharp
var userPromptControl = new UserPromptControl() { ... };
Window owner = null; // Use default
UserPromptWindow.ShowDialog(
userPromptControl,
"Window Title",
owner,
window => {
window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
});
```
--------------------------------
### Configure WPF Context Menu with MVVM
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/bars/menu-features/context-menus.md
Example of setting up a WPF BarContextMenu to use MVVM by binding ItemContainerTemplateSelector and ItemsSource.
```xaml
xmlns:bars="http://schemas.actiprosoftware.com/winfx/xaml/bars"
...
```
--------------------------------
### Configure Avalonia Context Menu with MVVM
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/bars/menu-features/context-menus.md
Example of setting up an Avalonia BarMenuFlyout to use MVVM by binding ItemContainerTemplateSelector and ItemsSource.
```xaml
xmlns:actipro="http://schemas.actiprosoftware.com/avaloniaui"
...
```
--------------------------------
### Initialize User Prompt Control After Creation (Avalonia)
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/fundamentals/user-prompt/builder-pattern.md
Use the AfterInitialize callback to perform initial setup or customization on the UserPromptControl immediately after it's created, before builder configurations are applied. This is for Avalonia applications.
```csharp
var result = await UserPromptBuilder.Configure()
// ... other configuration options here
.AfterInitialize(builder => {
// Define logic here
})
.Show();
```
--------------------------------
### Show Basic Question with MessageBox (Avalonia)
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/fundamentals/user-prompt/index.md
Demonstrates using the MessageBox API to prompt the user with a Yes/No question and a question icon. Requires the MessageBox class.
```csharp
var result = await MessageBox.Show(
"The specified file already exists. Do you want to overwrite the file?",
"Overwrite existing file?",
MessageBoxButtons.YesNo,
MessageBoxImage.Question);
```
--------------------------------
### Setting Symbology Properties (QRCode)
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/data-visualization/barcodes/barcode-basics.md
Encoding-related properties, such as ErrorCorrectionLevel and Version, are set on the symbology object. This example shows settings for QrCodeSymbology.
```xaml
xmlns:actipro="http://schemas.actiprosoftware.com/avaloniaui"
...
```
--------------------------------
### Display WPF User Prompt with Yes/No Buttons
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/fundamentals/user-prompt/builder-pattern.md
Demonstrates configuring and showing a user prompt with a header, content, standard Yes/No buttons, and a question icon in WPF. The Show method is called directly.
```csharp
var result = UserPromptBuilder.Configure()
.WithHeaderContent("Overwrite existing file?")
.WithContent("The specified file already exists. Do you want to overwrite the file?")
.WithStandardButtons(UserPromptStandardButtons.YesNo)
.WithStatusImage(UserPromptStandardImage.Question)
.Show();
```
--------------------------------
### Setting Symbology Properties (Code128)
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/data-visualization/barcodes/barcode-basics.md
Encoding-related properties, such as BarHeight, are set on the symbology object itself. This example shows setting BarHeight for Code128Symbology.
```xaml
xmlns:actipro="http://schemas.actiprosoftware.com/avaloniaui"
...
```
--------------------------------
### Display Avalonia User Prompt with Yes/No Buttons
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/fundamentals/user-prompt/builder-pattern.md
Demonstrates configuring and showing a user prompt with a header, content, standard Yes/No buttons, and a question icon in Avalonia. The Show method returns a Task that must be awaited.
```csharp
var result = await UserPromptBuilder.Configure()
.WithHeaderContent("Overwrite existing file?")
.WithContent("The specified file already exists. Do you want to overwrite the file?")
.WithStandardButtons(MessageBoxButtons.YesNo)
.WithStatusImage(MessageBoxImage.Question)
.Show();
```
--------------------------------
### Show Basic Question with ThemedMessageBox (WPF)
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/fundamentals/user-prompt/index.md
Demonstrates using the ThemedMessageBox API to prompt the user with a Yes/No question and a question image. Requires the ThemedMessageBox class.
```csharp
var result = ThemedMessageBox.Show(
"The specified file already exists. Do you want to overwrite the file?",
"Overwrite existing file?",
MessageBoxButton.YesNo,
MessageBoxImage.Question);
```
--------------------------------
### Minimal RibbonWindow Configuration
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/bars/ribbon-features/ribbon-window.md
Demonstrates the basic structure for hosting a Ribbon control within a RibbonWindow. Ensure the actipro namespace is correctly defined.
```xaml
```
--------------------------------
### Configure User Prompt with Simple String Content (Avalonia)
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/fundamentals/user-prompt/user-prompt-content.md
Use the WithContent method to set a simple string as the primary message of the user prompt. This is a common use case for basic prompts.
```csharp
await UserPromptBuilder.Configure()
// ... other configuration options here
.WithContent("Simple string-based content")
.Show();
```
--------------------------------
### ModernTheme with Actipro Pro Controls
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/themes/getting-started.md
Include styles for Actipro's Pro controls. This example excludes the native ColorPicker and DataGrid controls.
```xaml
```
--------------------------------
### Avalonia Toolbar BarMenuGallery Example
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/bars/controls/gallery.md
Illustrates using a BarMenuGallery within a StandaloneToolBar's popup menu in Avalonia. This is for toolbar context galleries.
```xaml
xmlns:actipro="http://schemas.actiprosoftware.com/avaloniaui"
...
...
```
--------------------------------
### Create and Show Context Menu in WPF
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/shared/menu-factory.md
Example of creating a context menu with standard edit commands for a WPF application. It utilizes ActiproSoftware.Properties.Shared and WPF-specific properties for menu display.
```csharp
using ActiproSoftware.Properties.Shared;
...
var menuFactory = MenuFactory.Current;
var menu = menuFactory.CreateMenu();
menu.Items.Add(menuFactory.CreateMenuItem(new MenuFactoryMenuItemOptions() { Key = CommandKeys.Edit.Cut, Text = "Cu_t", Command = ApplicationCommands.Cut } ));
menu.Items.Add(menuFactory.CreateMenuItem(new MenuFactoryMenuItemOptions() { Key = CommandKeys.Edit.Copy, Text = "_Copy", Command = ApplicationCommands.Copy } ));
menu.Items.Add(menuFactory.CreateMenuItem(new MenuFactoryMenuItemOptions() { Key = CommandKeys.Edit.Paste, Text = "_Paste", Command = ApplicationCommands.Paste } ));
menu.Items.Add(menuFactory.CreateMenuSeparator());
menu.Items.Add(menuFactory.CreateMenuItem(new MenuFactoryMenuItemOptions() { Key = CommandKeys.Edit.Delete, Text = "_Delete", Command = ApplicationCommands.Delete } ));
menu.Placement = PlacementMode.Bottom;
menu.PlacementTarget = myControl;
menu.IsOpen = true;
```
--------------------------------
### WPF Popup Button in Menu
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/bars/controls/popup-button.md
Example of a BarMenuItem used as a popup button within a WPF BarContextMenu. The label is auto-generated from the Key property.
```xaml
xmlns:bars="http://schemas.actiprosoftware.com/winfx/xaml/bars"
...
...
```
--------------------------------
### Customize UserPromptWindow with Builder Pattern (Avalonia)
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/fundamentals/user-prompt/appearance.md
Leverage the builder pattern's `AfterInitializeWindow` callback to customize the `UserPromptWindow` after its initialization but before it is shown. This provides an alternative to the `ShowDialog` callback.
```csharp
await UserPromptBuilder.Configure()
// ... other configuration options here
.AfterInitializeWindow(window => {
window.FlowDirection = FlowDirection.RightToLeft;
})
.Show();
```
--------------------------------
### Set UserPromptBuilder Startup Location (Avalonia)
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/fundamentals/user-prompt/display-and-results.md
Configures the UserPromptBuilder to set the WindowStartupLocation to CenterOwner for the displayed prompt in Avalonia.
```csharp
await UserPromptBuilder.Configure()
// ... other configuration options here
.WithWindowStartupLocation(WindowStartupLocation.CenterOwner)
.Show();
```
--------------------------------
### Avalonia Popup Button in Menu
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/bars/controls/popup-button.md
Example of a BarMenuItem used as a popup button within an Avalonia BarMenuFlyout. The label is auto-generated from the Key property.
```xaml
xmlns:actipro="http://schemas.actiprosoftware.com/avaloniaui"
...
...
```
--------------------------------
### WPF BarPopupButton in StandaloneToolBar
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/bars/controls/popup-button.md
Example of using BarPopupButton within a StandaloneToolBar in WPF. The label is auto-generated from the Key. Includes a BarMenuItem within the popup.
```xaml
xmlns:bars="http://schemas.actiprosoftware.com/winfx/xaml/bars"
...
...
```
--------------------------------
### SettingsCard with Header and Description (WPF)
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/fundamentals/controls/settings-card.md
Use this snippet to create a SettingsCard with a basic header and description. Ensure the Actipro WPF Views namespace is included.
```xaml
xmlns:views="http://schemas.actiprosoftware.com/winfx/xaml/views"
...
```
--------------------------------
### Avalonia BarPopupButton in StandaloneToolBar
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/bars/controls/popup-button.md
Example of using BarPopupButton within a StandaloneToolBar in Avalonia. The label is auto-generated from the Key. Includes a BarMenuItem within the popup.
```xaml
xmlns:actipro="http://schemas.actiprosoftware.com/avaloniaui"
...
...
```
--------------------------------
### Basic Barcode Setup
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/data-visualization/barcodes/barcode-basics.md
A minimal barcode requires a BarcodePresenter, a symbology object (like Code128Symbology), and the Value property set to the data to encode.
```xaml
xmlns:actipro="http://schemas.actiprosoftware.com/avaloniaui"
...
```
--------------------------------
### Tab Appearance Example
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/themes/getting-started.md
Set the tab appearance kind to 'Subtle' for a less prominent tab design. This affects how tabs are rendered within the application.
```xaml
```
--------------------------------
### Display Exception Details in User Prompt (Avalonia)
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/fundamentals/user-prompt/extension-methods.md
Use the `ForException` extension method to pre-configure a user prompt with exception details, including error summary and stack trace. Requires importing `ActiproSoftware.UI.Avalonia.Controls`.
```csharp
try {
//
}
catch (Exception ex) {
await UserPromptBuilder.Configure()
.ForException(ex, "Custom header text.")
.Show();
}
```
--------------------------------
### Configure User Prompt Buttons with Labels (Avalonia)
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/fundamentals/user-prompt/user-prompt-buttons.md
Use the `WithButton` method to add buttons to a user prompt. This example shows how to specify a custom label for a button.
```csharp
await UserPromptBuilder.Configure()
// ... other configuration options here
.WithButton(MessageBoxResult.Cancel)
.WithButton(MessageBoxResult.Ignore, label: "Continue")
.Show();
```
--------------------------------
### Set Fixed Container Height for ToolWindow
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/docking/docking-window-features/lifecycle-and-docking-management.md
Achieve a fixed container height by setting both ContainerMinSize and ContainerMaxSize to the same value. This example fixes the height to 180.
```xaml
... ...
```
```xaml
... ...
```
--------------------------------
### WPF Basic Docking Window Layout
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/docking/getting-started.md
Create a simple docking window layout with document and tool windows using Actipro WPF controls.
```xaml
```
--------------------------------
### Initialize User Prompt Control After Creation (WPF)
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/fundamentals/user-prompt/builder-pattern.md
Use the AfterInitialize callback to perform initial setup or customization on the UserPromptControl immediately after it's created, before builder configurations are applied. This is for WPF applications.
```csharp
var result = UserPromptBuilder.Configure()
// ... other configuration options here
.AfterInitialize(builder => {
// Define logic here
})
.Show();
```
--------------------------------
### Assign Key Tip Text to BarButton (WPF)
Source: https://github.com/actipro/avalonia-controls/blob/develop/Documentation/topics/bars/ribbon-features/key-tips.md
Set the KeyTipText property on a BarButton to enable keyboard navigation. This example shows the XAML for WPF.
```xaml
xmlns:bars="http://schemas.actiprosoftware.com/winfx/xaml/bars"
...
```