-
Notifications
You must be signed in to change notification settings - Fork 263
Window
闫驚鏵(Jinhua Yan) edited this page Jul 9, 2023
·
5 revisions
<wd:Window
x:Class="WPFDevelopers.Samples.ExampleViews.NoChromeWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:WPFDevelopers.Samples.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:wd="https://github.com/WPFDevelopersOrg/WPFDevelopers"
Title="NoChromeWindow"
Width="400"
Height="300"
BorderBrush="Transparent"
BorderThickness="0"
NoChrome="True"
ResizeMode="NoResize"
TitleHeight="30"
WindowStartupLocation="CenterScreen"
WindowStyle="ToolWindow"
mc:Ignorable="d">
<wd:Window.TitleBar>
<Grid Height="40" VerticalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" MinWidth="30" />
</Grid.ColumnDefinitions>
<TextBlock
Margin="10,0"
VerticalAlignment="Center"
FontSize="14"
Foreground="{StaticResource WD.SecondaryTextSolidColorBrush}"
IsHitTestVisible="False"
Text="ToolWindow" />
<Button
x:Name="CloseButton"
Grid.Column="2"
Width="30"
Height="30"
HorizontalAlignment="Right"
Click="CloseButton_Click"
Style="{StaticResource WD.WindowButtonStyle}"
ToolTip="关闭">
<Path
Width="10"
Height="10"
Data="{StaticResource WD.WindowCloseGeometry}"
Fill="DarkGray"
Stretch="UniformToFill" />
</Button>
</Grid>
</wd:Window.TitleBar>
<Grid>
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="Content" />
</Grid>
</wd:Window>
public partial class NoChromeWindow
{
public NoChromeWindow()
{
InitializeComponent();
}
private void CloseButton_Click(object sender, RoutedEventArgs e)
{
Close();
}
}
<wd:Window
x:Class="WPFDevelopers.Samples.ExampleViews.NoneNoChromeWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:WPFDevelopers.Samples.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:wd="https://github.com/WPFDevelopersOrg/WPFDevelopers"
Title="NoChromeWindow"
Width="400"
Height="300"
BorderBrush="{StaticResource WD.DangerSolidColorBrush}"
BorderThickness="1"
NoChrome="True"
TitleHeight="30"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<wd:Window.TitleBar>
<Grid Height="40" VerticalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" MinWidth="30" />
</Grid.ColumnDefinitions>
<Rectangle
Grid.ColumnSpan="3"
Fill="{StaticResource WD.DangerSolidColorBrush}"
IsHitTestVisible="False" />
<TextBlock
Margin="10,0"
VerticalAlignment="Center"
Foreground="{StaticResource WD.WindowForegroundColorBrush}"
IsHitTestVisible="False"
Text="Danger" />
<Button
x:Name="CloseButton"
Grid.Column="2"
Width="30"
Height="30"
HorizontalAlignment="Right"
Click="CloseButton_Click"
Style="{StaticResource WD.WindowButtonStyle}"
ToolTip="关闭">
<Path
Width="10"
Height="10"
Data="{StaticResource WD.WindowCloseGeometry}"
Fill="{StaticResource WD.WindowForegroundColorBrush}"
Stretch="UniformToFill" />
</Button>
</Grid>
</wd:Window.TitleBar>
<Grid>
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="Content" />
</Grid>
</wd:Window>
public partial class NoneNoChromeWindow
{
public NoneNoChromeWindow()
{
InitializeComponent();
}
private void CloseButton_Click(object sender, RoutedEventArgs e)
{
Close();
}
}