我用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>发布于 2022-09-21 08:08:50
您需要定义“BlueButton”按钮样式,并在App.xaml或graffic.MainWindow.xaml中作为Window.Resource对其进行引用。
查看一下Microsoft文档:
https://learn.microsoft.com/en-us/windows/apps/design/style/xaml-resource-dictionary
https://stackoverflow.com/questions/73793347
复制相似问题