我写在xaml,我试图把一个样式按钮,所以它扔给我这个错误XDG0062资源“BlueButton”无法解决。
这是我的代码
<Window x:Class="grafic.MainWindow"
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:grafic"
mc:Ignorable="d"
Title="welcome" Height="450" Width="800">
<Grid>
<Grid.Background>
<ImageBrush Stretch="Fill" ImageSource="thil.png" AlignmentY="Top" AlignmentX="Center"/>
</Grid.Background>
<Button
Style="{StaticResource BlueButton}"
BorderBrush="#fff"
x:Name="signIn"
Content="Sign in"
Background="RED" Margin="297,40,347,333" FontWeight="Bold" FontSize="36" Click="signIn_Click"
/>
</Grid>
1条答案
按热度按时间shyt4zoc1#
您需要定义'BlueButton'按钮样式,并在App.xaml中引用它,或者将其作为graffic.MainWindow.xaml中的Window.Resource。
请查看Microsoft文档:
https://learn.microsoft.com/en-us/windows/apps/design/style/xaml-resource-dictionary