【问题标题】:How to Customize window title Extended,Gradient如何自定义窗口标题扩展,渐变
【发布时间】:2013-04-09 08:15:57
【问题描述】:

Window x:Class="WPF_UI.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Mian Window" WindowStyle="None" AllowsTransparency="True" Width="775" Height="500"

我已经自定义了我的窗口标题 Extended,Gradient.How 应该在 wpf 中做什么。

我必须让窗口看起来像 abv 图像

【问题讨论】:

标签: .net wpf visual-studio-2010 wpf-controls


【解决方案1】:

试试这个覆盖窗口倾斜栏上的堆栈面板。 使 WindowStyle="None" ResizeMode="NoResize" 并调整控件的边距(MAKE TOP NEGATIVE OF STACKPANEL) 以覆盖标题栏上的窗口堆栈面板。

<Window x:Class="WPF_UI.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
       WindowStyle="None" WindowStartupLocation="CenterScreen" ResizeMode="NoResize"  Width="920" Height="600" >

<Grid>....other stack panels....
**Here i have take stack panel to overwrite on window title bar.**
<StackPanel Margin="0,-566,0,5" Grid.ColumnSpan="3" Height="25" DataContext="{Binding}">
                <StackPanel.Background>
                    <LinearGradientBrush>
                        <GradientStop Color="White" Offset=".2" />
                        <GradientStop Color="Gray" Offset=".5" />
                        <GradientStop Color="Black" Offset="1" />
                    </LinearGradientBrush>
                </StackPanel.Background>
                <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" Margin="1,5,0,0"> APPLICATION NAME
                </TextBlock>
                <Button Content="Close" Margin="860,-17,0,0" VerticalAlignment="Center" HorizontalAlignment="Left" Name="btnClose" Width="40" >
                    <Button.Background>
                        <LinearGradientBrush StartPoint="0,0" EndPoint="0,2">
                            <GradientStop Color="Black" Offset=".2" />
                            <GradientStop Color="Gray" Offset=".5" />
                            <GradientStop Color="White" Offset="1" />
                        </LinearGradientBrush>
                    </Button.Background>
                </Button>
            </StackPanel>
</Grid>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-11-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-31
    • 1970-01-01
    • 2014-07-05
    相关资源
    最近更新 更多