I am making a game engine and I was codding a new UI and it is giving the following error "Error XDG0062 'StaticResourceExtension' is not valid for Setter.Value. The only supported MarkupExtension types are DynamicResourceExtension and BindingBase or derived types."
Here is the only code that was added since the last working build
ControlTemplate.xaml
<ResourceDictionary x:Class="Pico_Editor.Dictionaries.ControlTemplates"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Pico_Editor.Dictionaries">
<Style TargetType="{x:Type TextBox}" x:Key="TextBoxStyle">
<!-- TODO: define the look of textbox here -->
</Style>
<Style TargetType="{x:Type TextBox}" x:Key="{x:Type TextBox}" BasedOn="{StaticResource TextBoxStyle}">
<EventSetter Event="KeyDown" Handler="OnTextBox_KeyDown"/>
</Style>
<Style x:Key="PicoWindowStyle" TargetType="{x:Type Window}">
<Setter Property="BorderBrush" Value="{StaticResource Editor.Selected.BackgroundBrush}"/>
<Setter Property="Background" Value="{StaticResource Editor.Window.GrayBrush1}"/>
</Style>
</ResourceDictionary>
EditorColors.xaml
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Pico_Editor.Dictionaries">
<!-- Editor Colors -->
<Color x:Key="Editor.Window.GrayColor1"> #ff1f1f1f</Color>
<Color x:Key="Editor.Window.GrayColor2"> #ff262626</Color>
<Color x:Key="Editor.Window.GrayColor3"> #ff313131</Color>
<Color x:Key="Editor.Window.GrayColor4"> #ff404040</Color>
<Color x:Key="Editor.Window.GrayColor5"> #ff535353</Color>
<Color x:Key="Editor.Window.GrayColor6"> #ff6a6a6a</Color>
<Color x:Key="Editor.Disabled.FontColor"> #ff868686</Color>
<Color x:Key="Editor.FontColor"> #ffdddddd</Color>
<Color x:Key="Editor.RedColor"> #ffff5a6a</Color>
<Color x:Key="Editor.GreenColor"> #ff90ee90</Color>
<Color x:Key="Editor.BlueColor"> #ff80deff</Color>
<Color x:Key="Editor.OrangeColor"> #ffffd067</Color>
<Color x:Key="Editor.Selected.BackgroundColor"> #ff3c67b6</Color>
<!-- Editor Brushes -->
<SolidColorBrush Color="{StaticResource Editor.Window.GrayColor1}" x:Key="Editor.Window.GrayBrush1"/>
<SolidColorBrush Color="{StaticResource Editor.Window.GrayColor2}" x:Key="Editor.Window.GrayBrush2"/>
<SolidColorBrush Color="{StaticResource Editor.Window.GrayColor3}" x:Key="Editor.Window.GrayBrush3"/>
<SolidColorBrush Color="{StaticResource Editor.Window.GrayColor4}" x:Key="Editor.Window.GrayBrush4"/>
<SolidColorBrush Color="{StaticResource Editor.Window.GrayColor5}" x:Key="Editor.Window.GrayBrush5"/>
<SolidColorBrush Color="{StaticResource Editor.Window.GrayColor6}" x:Key="Editor.Window.GrayBrush6"/>
<SolidColorBrush Color="{StaticResource Editor.Disabled.FontColor}" x:Key="Editor.Disabled.FontBrush"/>
<SolidColorBrush Color="{StaticResource Editor.FontColor}" x:Key="Editor.FontBrush"/>
<SolidColorBrush Color="{StaticResource Editor.RedColor}" x:Key="Editor.RedBrush"/>
<SolidColorBrush Color="{StaticResource Editor.GreenColor}" x:Key="Editor.GreenBrush"/>
<SolidColorBrush Color="{StaticResource Editor.BlueColor}" x:Key="Editor.BlueBrush"/>
<SolidColorBrush Color="{StaticResource Editor.OrangeColor}" x:Key="Editor.OrangeBrush"/>
<SolidColorBrush Color="{StaticResource Editor.Selected.BackgroundColor}" x:Key="Editor.Selected.BackgroundBrush"/>
</ResourceDictionary>
I also added Style="{StaticResource PicoWindowStyle}"
to the window section of my main window
Any help will be appreciated I have no clue what the problem is and i cnat see anything wrong with the code
CodePudding user response:
I forgot that xaml has top down code flow and my App.xalm file had
<ResourceDictionary Source="pack://application:,,,/Dictionaries/ControlTemplates.xaml"/>
on top of
<ResourceDictionary Source="pack://application:,,,/Dictionaries/EditorColors.xaml"/>
but it had to be the other way around