C
C#•3mo ago
LETO

Constants for WPF

atm I'm using static resources in the 'main' xaml page e.g:
<Window.Resources>
<SolidColorBrush x:Key="colour_1" Color="#FE1E3C"/>
<SolidColorBrush x:Key="colour_2" Color="#fffcf9"/>
<SolidColorBrush x:Key="colour_3" Color="#426A5A"/>
<SolidColorBrush x:Key="colour_4" Color="#6D435A"/>
<SolidColorBrush x:Key="colour_5" Color="#352d39"/>
</Window.Resources>
<Window.Resources>
<SolidColorBrush x:Key="colour_1" Color="#FE1E3C"/>
<SolidColorBrush x:Key="colour_2" Color="#fffcf9"/>
<SolidColorBrush x:Key="colour_3" Color="#426A5A"/>
<SolidColorBrush x:Key="colour_4" Color="#6D435A"/>
<SolidColorBrush x:Key="colour_5" Color="#352d39"/>
</Window.Resources>
Is there away to access these from other xaml classes, or will I have to make a constants class and figure out how to use those constants within the markup stuff?
2 Replies
LETO
LETOOP•3mo ago
Ah, I have just discovered App.xaml issue is resolved 🙂
canton7
canton7•3mo ago
Also resource dictionaries
Want results from more Discord servers?
Add your server