110,555
社区成员
发帖
与我相关
我的任务
分享
<Style TargetType="{x:Type Window}" x:Key="BaseWindow">
<Setter Property="WindowStyle" Value="None"/>
<Setter Property="AllowsTransparency" Value="True" />
<Setter Property="Width" Value="800"/>
<Setter Property="Height" Value="600"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Border Background="White">
<DockPanel LastChildFill="True">
<Grid Width="auto" Height="80" VerticalAlignment="Top" HorizontalAlignment="Stretch" DockPanel.Dock="Top">
<Viewbox Stretch="Fill">
<Canvas Width="790" Height="80">
<StackPanel>
<DockPanel Name="window" MouseMove="window_MouseMove" MouseDown="window_MouseDown" Background="#4C9CFB" Width="790" Height="40" >
<TextBlock Name="txtTitle" Text=" AAA" FontSize="18" FontFamily="微软雅黑" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" />
<Button Name="btnClose" Content="X" Width="25" Height="25" DockPanel.Dock="Right" HorizontalAlignment="Right" Margin="3,0" Click="btnClose_Click"/>
</DockPanel>
</StackPanel>
</Canvas>
</Viewbox>
</Grid>
<AdornerDecorator>
<ContentPresenter />
</AdornerDecorator>
</DockPanel>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Window x:Class="ApiDemo2.View.BaseWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
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"
xmlns:local="clr-namespace:ApiDemo2.View"
mc:Ignorable="d" Style="{StaticResource BaseWindow}"
Title="BaseWindow" WindowStartupLocation="CenterScreen">
<Grid>
<Button>a</Button>
</Grid>
</Window>
Text="{Binding Title}"
<ContentPresenter />
-》改为 <ContentPresenter Content="{Binding Content}" />