惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 【当耐特】
S
Schneier on Security
Blog — PlanetScale
Blog — PlanetScale
MyScale Blog
MyScale Blog
Apple Machine Learning Research
Apple Machine Learning Research
Google DeepMind News
Google DeepMind News
aimingoo的专栏
aimingoo的专栏
The GitHub Blog
The GitHub Blog
腾讯CDC
A
About on SuperTechFans
H
Help Net Security
The Register - Security
The Register - Security
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 三生石上(FineUI控件)
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Vercel News
Vercel News
V
Visual Studio Blog
T
Tailwind CSS Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园 - Franky
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
D
DataBreaches.Net
I
InfoQ
L
Lohrmann on Cybersecurity
M
MIT News - Artificial intelligence
I
Intezer
博客园 - 聂微东
Webroot Blog
Webroot Blog
宝玉的分享
宝玉的分享
Scott Helme
Scott Helme
Microsoft Security Blog
Microsoft Security Blog
SecWiki News
SecWiki News
Hacker News: Ask HN
Hacker News: Ask HN
T
Troy Hunt's Blog
S
Security @ Cisco Blogs
Application and Cybersecurity Blog
Application and Cybersecurity Blog
D
Docker
N
Netflix TechBlog - Medium
小众软件
小众软件
The Cloudflare Blog
WordPress大学
WordPress大学
N
News | PayPal Newsroom
C
Check Point Blog
Google Online Security Blog
Google Online Security Blog
月光博客
月光博客
C
Cisco Blogs
阮一峰的网络日志
阮一峰的网络日志
W
WeLiveSecurity
Schneier on Security
Schneier on Security

博客园 - dalgleish

C# Avalonia 22- SoundAndVideo- SpeechVoiceTest C# Avalonia 22- SoundAndVideo- SpeechRecognition C# Avalonia 22- SoundAndVideo- SpeechSynthesis C# Avalonia 22- SoundAndVideo- CodePlayback C# Avalonia 22- SoundAndVideo- SoundPlayerTest C# Avalonia 21- MenusAndToolbars- RibbonTest C# Avalonia 21- MenusAndToolbars- ProportionalStatusBar C# Avalonia 21- MenusAndToolbars- BasicToolbar C# Avalonia 21- MenusAndToolbars- ToolBar/Ribbon开源项目介绍和修复 C# Avalonia 21- MenusAndToolbars- SidebarMenu C# Avalonia 20 - WindowsMenu- 魔改Hyperlink - 使用例子 C# Avalonia 20 - WindowsMenu- 魔改Hyperlink C# Avalonia 20 - WindowsMenu- WebViewTest C# Avalonia 20 - WindowsMenu- WebView C# Avalonia 20 - WindowsMenu- ModernWindowTest C# Avalonia 20 - WindowsMenu- ModernWindow C# Avalonia 20 - WindowsMenu- TransparentWithShapes C# Avalonia 20 - WindowsMenu- TransparentBackground C# Avalonia 20 - WindowsMenu- OpenFileTest C# Avalonia 20 - WindowsMenu- SavePostion C# Avalonia 20 - WindowsMenu- CenterScreen C# Avalonia 19- DataBinding- DataGridGrouping C# Avalonia 19- DataBinding- DirectoryTreeView C# Avalonia 19- DataBinding- BoundTreeView C# Avalonia 19- DataBinding- CustomListViewTest
C# Avalonia 21- MenusAndToolbars- MixedMenus
dalgleish · 2026-04-05 · via 博客园 - dalgleish

MixedMenus.axaml

<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        Height="300" Width="300"
        xmlns:local="using:AvaloniaUI"
        x:DataType="local:MixedMenus"
        x:Class="AvaloniaUI.MixedMenus"
        Title="MixedMenus">
    
    <Grid Margin="5"
           RowDefinitions="auto,auto,auto"
           ColumnDefinitions="*,*">
        <!-- 左上:Menu + Button -->
        <StackPanel Grid.Row="0" Grid.Column="0">
            <Menu VerticalAlignment="Top">
                <MenuItem Header="File">
                    <MenuItem Header="Open"/>
                </MenuItem>
                <MenuItem Header="Help"/>
            </Menu>

            <Button Padding="3" Margin="5">An Ordinary Button</Button>
        </StackPanel>

        <!-- 左中:TextBox -->
        <TextBox Grid.Row="1" Grid.Column="0" Margin="5" Text="A TextBox"/>

        <!-- 右中:CheckBox + Menu -->
        <StackPanel Grid.Row="1" Grid.Column="1">
            <CheckBox Margin="5">A CheckBox</CheckBox>
            <Menu VerticalAlignment="Top">
                <MenuItem Header="File"/>
                <MenuItem Header="Help"/>
            </Menu>
        </StackPanel>

        <!-- 底部:Menu -->
        <Menu Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2"
              Margin="5"
              VerticalAlignment="Top"
              HorizontalAlignment="Left">
            <MenuItem Header="File">
                <MenuItem Header="New"/>
                <Separator/>
                <MenuItem Header="Open">
                    <MenuItem Header="Open More"/>
                </MenuItem>
                <MenuItem Header="Save" InputGesture="Ctrl+S"
                          HotKey="Ctrl+S" Command="{Binding SaveCommand}">
                    <MenuItem.Icon>
                        <PathIcon Data="M4,4 H14 V14 H4 Z M8,8 H18 V18 H8 Z"/>
                    </MenuItem.Icon>
                </MenuItem>
            </MenuItem>
        </Menu>
    </Grid>    
</Window>

MixedMenus.axaml.cs

using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using CommunityToolkit.Mvvm.Input;
using Shares.Avalonia;

namespace AvaloniaUI;

public partial class MixedMenus : Window
{
    public MixedMenus()
    {
        InitializeComponent();
        this.DataContext = this;
    }

    [RelayCommand]
    private void Save()
    {
        MessageBox.Show(this, "Save command");
    }
}

运行效果

image