Home > Software design >  "XDG0062 The resource "BlueButton" could not be resolved
"XDG0062 The resource "BlueButton" could not be resolved

Time:10-12

I write in xaml, I tried to put a style button, so it threw me this error XDG0062 The resource "BlueButton" could not be resolved.

Here is my code

<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>

CodePudding user response:

You need to have the 'BlueButton' button style defined and reference made to it in either the App.xaml or as a Window.Resource in your graffic.MainWindow.xaml.

Have a look at the Microsoft docs:

https://learn.microsoft.com/en-us/windows/apps/design/style/xaml-resource-dictionary

  • Related