Après avoir créé ControlTemplate pour la fenêtre Wpf, cela fonctionne correctement en mode Création. Mais quand je cours, il ne montre pas la bordure rouge extérieure.wpf Le modèle de contrôle ne fonctionne pas au moment de l'exécution
ici est mon code
<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525"
WindowStyle="None"
AllowsTransparency="True"
WindowStartupLocation="CenterScreen"
>
<Window.Resources>
<Style TargetType="Window">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Window">
<Border Padding="20" Background="red">
<ContentPresenter Content="{TemplateBinding Content}" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<WindowChrome.WindowChrome>
<WindowChrome
ResizeBorderThickness="10"
CaptionHeight="40"
CornerRadius="0"
GlassFrameThickness="0"
/>
</WindowChrome.WindowChrome>
<Grid>
<Border Background="Black" Padding="20">
<Button Content="ok"/>
</Border>
</Grid>
</Window>
La frontière extérieure rouge ne pas montrer quand je le lance. Quelqu'un peut-il me dire si j'ai fait une erreur?
Merci beaucoup. Maintenant, je comprends de votre exemple simple. –