AgentStack
SKILL verified MIT Self-run

Avalonia Controls Navigation

skill-linuxdevel-avalonia-skills-navigation · by linuxdevel

Use when working with Avalonia navigation controls: TabControl, Menu, ContextMenu, MenuItem, NativeMenu, or TrayIcon. Covers tab binding, menu command wiring, access keys, context menu DataContext resolution, and tray icon setup for Avalonia 12 desktop apps.

No reviews yet
0 installs
11 views
0.0% view→install

Install

$ agentstack add skill-linuxdevel-avalonia-skills-navigation

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Avalonia Controls Navigation? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Avalonia Navigation Controls

Overview

Navigation controls let users move between views or trigger application commands. All menu controls support Command binding and keyboard shortcuts via InputGesture.


TabControl

Displays content in tabbed panels. Tabs can be static (inline TabItem) or dynamic (bound ItemsSource).

| Property | Type | Notes | |---|---|---| | SelectedIndex | int | TwoWay | | SelectedItem | object | TwoWay | | TabStripPlacement | Dock | Top (default), Bottom, Left, Right | | ItemsSource | IEnumerable | For dynamic tabs | | ItemTemplate | DataTemplate | Header template for dynamic tabs | | ContentTemplate | DataTemplate | Body template for dynamic tabs |

TabItem properties:

| Property | Notes | |---|---| | Header | Tab label (string or XAML) | | Content | Tab body | | IsEnabled | Disables individual tab | | IsSelected | Set programmatically |


    
        
    
    
        
    
    
        
    

    
        
            
                
                
            
        
        
    

Dynamic tabs (ViewModel-driven):


    
        
        
            
                
                
            
        
    
    
        
        
            
        
    
public class TabVm
{
    public string Title { get; set; } = "";
    public object? Content { get; set; }
}

Menu

Top-level application menu bar. Contains MenuItem hierarchy.

| Property | Notes | |---|---| | Header | Text label; prefix with _ for access key | | Command | Bound command | | CommandParameter | Passed to command | | Icon | Left-side icon (usually Image or PathIcon) | | InputGesture | Keyboard shortcut (display only for top-level; functional for items) | | Items | Sub-menu items | | IsEnabled | Disables item |


    
        
            
                
            
        
        
        
        
            
                
                    
                
            
        
        
        
    

    
        
        
        
    

    
        
    

ContextMenu

Attached to any control. Shown on right-click.

| Property | Notes | |---|---| | Items | MenuItem list | | IsOpen | Programmatic open/close |


    
        
            
            
            
            
        
    
    
        
            
        
    

> DataContext pitfall: ContextMenu is not in the visual tree of its host control. Its DataContext is the control's DataContext by default, but ancestor binding ($parent[Window]) must be used to reach the Window's ViewModel. Alternatively, set DataContext explicitly in code.

// Set ContextMenu DataContext explicitly in code-behind
myControl.ContextMenu!.DataContext = this.DataContext;

NativeMenu

Platform-native menus. Used for macOS app menus and TrayIcon menus.


    

    
        
        
        
    

TrayIcon

System tray icon for desktop apps. Desktop lifetime only.

In App.axaml:


    
        
            
                
                    
                        
                        
                        
                        
                    
                
            
        
    
// In App.axaml.cs — wire DataContext for TrayIcon commands
public override void OnFrameworkInitializationCompleted()
{
    if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
    {
        var vm = new MainWindowViewModel();
        desktop.MainWindow = new MainWindow { DataContext = vm };

        // TrayIcon DataContext
        if (TrayIcon.GetIcons(this) is { } icons)
            foreach (var icon in icons)
                icon.DataContext = vm;  // or a dedicated TrayIconVm
    }
    base.OnFrameworkInitializationCompleted();
}

Icon formats: .ico recommended for Windows; .png works on Linux/macOS.


Common Mistakes

| Mistake | Fix | |---|---| | Access key not working in MenuItem.Header | Use _ prefix: Header="_File" (Alt+F). Without _, no access key is registered | | ContextMenu command binding fails | ContextMenu is not in visual tree; use $parent[Window].DataContext.Cmd or set DataContext in code | | TrayIcon crashes on non-desktop lifetime | Guard: if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime) before using TrayIcon | | TabControl dynamic tabs show blank content | Provide both ItemTemplate (header) and ContentTemplate (body), or use ContentControl in body template | | MenuItem.InputGesture not firing | InputGesture on MenuItem only shows the hint; actual shortcut requires KeyBinding at the window level | | Dynamic submenu bound Items not showing | Use Items="{Binding ...}" with an ItemTemplate on the parent MenuItem, not ItemsSource |

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.