-
Notifications
You must be signed in to change notification settings - Fork 255
Window
闫驚鏵(Jinhua Yan) edited this page Dec 17, 2024
·
5 revisions
1)Xaml
ws:Window x:Class="WpfApp.MainWindow"
2)CSharp remove. Inheritance in CS file
public partial class MainWindow
1)Xaml
TitleBarMode="Normal"
1)Xaml
TitleBarMode="HighTitleBar"
1)Xaml
+ <wd:Window
+ xmlns:wd="https://github.com/WPFDevelopersOrg/WPFDevelopers"
+ BorderBrush="{StaticResource WD.DangerSolidColorBrush}"
+ BorderThickness="1"
+ TitleBackground="{StaticResource WD.DangerSolidColorBrush}"
+ NoChrome="True"
+ TitleHeight="30">
+ <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"
+ 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.NormalButton}"
+ ToolTip="关闭">
+ <wd:PathIcon
+ Width="10"
+ Height="10"
+ Foreground="{DynamicResource WD.WindowForegroundColorBrush}"
+ Kind="WindowClose" />
+ </Button>
+ </Grid>
+ </wd:Window.TitleBar>
<Grid>
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="Content" />
</Grid>
+ </wd:Window>
2)CSharp CloseClick
private void CloseButton_Click(object sender, RoutedEventArgs e)
{
Close();
}
1)Xaml
+ <wd:Window
+ xmlns:wd="https://github.com/WPFDevelopersOrg/WPFDevelopers"
+ BorderBrush="Transparent"
+ BorderThickness="0"
+ NoChrome="True"
ResizeMode="NoResize"
+ TitleHeight="30"
+ WindowStyle="ToolWindow">
+ <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>
2)CSharp CloseClick
private void CloseButton_Click(object sender, RoutedEventArgs e)
{
Close();
}