小编Jus*_*n C的帖子

WindowChrome - 无法单击标题栏中的按钮

我的 WPF 应用程序有一个自定义 WindowChrome 样式(从此处摘取: http: //www.bdevuyst.com/wpf-custom-title-bar-and-taskbar/)。

代码在这里:

<ResourceDictionary 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity">

    <!-- Simple style without anything to remove the title bar -->
    <Style x:Key="Style.Window.WindowStyleNoneWithTaskbar.Base" TargetType="{x:Type Window}">
        <Setter Property="shell:WindowChrome.WindowChrome" >
            <Setter.Value>
                <shell:WindowChrome GlassFrameThickness="0" />
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Window}">
                    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding Foreground}" BorderThickness="1" >
                        <ContentPresenter Content="{TemplateBinding Content}" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- Simple style with system buttons upper right -->
    <Style TargetType="{x:Type Window}" BasedOn="{StaticResource Style.Window.WindowStyleNoneWithTaskbar.Base}" x:Key="Style.Window.WindowStyleNoneWithTaskbar">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Window}"> …
Run Code Online (Sandbox Code Playgroud)

c# wpf xaml titlebar button

2
推荐指数
1
解决办法
4062
查看次数

标签 统计

button ×1

c# ×1

titlebar ×1

wpf ×1

xaml ×1