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

推荐订阅源

Webroot Blog
Webroot Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
SecWiki News
SecWiki News
S
Secure Thoughts
V2EX - 技术
V2EX - 技术
T
Tor Project blog
H
Hacker News: Front Page
P
Privacy International News Feed
Google DeepMind News
Google DeepMind News
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
V
Vulnerabilities – Threatpost
C
CERT Recently Published Vulnerability Notes
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
C
Cyber Attacks, Cyber Crime and Cyber Security
Help Net Security
Help Net Security
D
Darknet – Hacking Tools, Hacker News & Cyber Security
H
Heimdal Security Blog
AI
AI
PCI Perspectives
PCI Perspectives
Cyberwarzone
Cyberwarzone
P
Privacy & Cybersecurity Law Blog
AWS News Blog
AWS News Blog
Attack and Defense Labs
Attack and Defense Labs
The Last Watchdog
The Last Watchdog
K
Kaspersky official blog
T
The Exploit Database - CXSecurity.com
C
CXSECURITY Database RSS Feed - CXSecurity.com
Security Latest
Security Latest
Schneier on Security
Schneier on Security
Scott Helme
Scott Helme
L
Lohrmann on Cybersecurity
Cisco Talos Blog
Cisco Talos Blog
The Hacker News
The Hacker News
N
News and Events Feed by Topic
S
Schneier on Security
Simon Willison's Weblog
Simon Willison's Weblog
F
Fortinet All Blogs
T
Threatpost
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
V
V2EX
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
Apple Machine Learning Research
Apple Machine Learning Research
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
云风的 BLOG
云风的 BLOG
博客园_首页
Recent Announcements
Recent Announcements
G
Google Developers Blog
Martin Fowler
Martin Fowler

博客园 - dalgleish

C# Avalonia 23- OpenGL- 例子通用类 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 21- MenusAndToolbars- MixedMenus 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- 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 20 - WindowsMenu- TransparentBackground
dalgleish · 2026-03-21 · via 博客园 - dalgleish

TransparentBackground.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"
        SystemDecorations="None"
        TransparencyLevelHint="AcrylicBlur,Transparent"
        Background="Transparent"
        x:Class="AvaloniaUI.TransparentBackground"
        Title="TransparentBackground"
        PointerPressed="Window_PointerPressed">
    
    <Window.Background>
        <ImageBrush Source="avares://AvaloniaUI/Resources/Images/shapes.png"
                    Stretch="UniformToFill"
                    Opacity="0.7"/>
    </Window.Background>

    <Grid RowDefinitions="*,*,*,*">
        <Button Margin="20">A Sample Button</Button>
        <Button Margin="20"
                Grid.Row="2"
                Click="cmdClose_Click">
            Close
        </Button>
    </Grid>
</Window>

TransparentBackground.axaml.cs代码

using Avalonia;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;

namespace AvaloniaUI;

public partial class TransparentBackground : Window
{
    public TransparentBackground()
    {
        InitializeComponent();
    }

    private void Window_PointerPressed(object? sender, PointerPressedEventArgs e)
    {
        if (e.GetCurrentPoint(this).Properties.IsLeftButtonPressed)
            BeginMoveDrag(e);
    }

    private void cmdClose_Click(object? sender, RoutedEventArgs e)
    {
        Close();
    }
}

运行效果

image