C
C#2y ago
Dawnbomb

WPF properties not defined - settings 'not supported'

i presume this is because in .net7 settings was moved out of properties and into solution explorer, but i don't know how to refer to it now. Help 😠
14 Replies
Alexicon
Alexicon2y ago
What you have is correct but I suspect based on your error messages you did not add the properties namespace in your xaml. At the top of the xaml document you will see things like this:
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
These are xaml namespaces, similar to using statements in C#. You need to add your properties namespace to this section like this:
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:properties="clr-namespace:{yourproject}.Properties"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:properties="clr-namespace:{yourproject}.Properties"
just replace {yourproject} with whatever your projects namespace is. You can find a working example of what this looks like here: https://github.com/AlexLexicon/Discord.Example.BindingSettings
GitHub
GitHub - AlexLexicon/Discord.Example.BindingSettings
Contribute to AlexLexicon/Discord.Example.BindingSettings development by creating an account on GitHub.
Dawnbomb
Dawnbomb2y ago
WPF doesn't default to it's applications accessing it's own properties by default? ....i swear i'm trying to like wpf....i swear i'm trying to like wpf.... @Alexicon Now i get the name "Setting" does not exist, but...eh?
Dawnbomb
Dawnbomb2y ago
Alexicon
Alexicon2y ago
in your binding try Settings with an 's' at the end?
Dawnbomb
Dawnbomb2y ago
Didn't work, although im pretty sure its supposed to be looking for ColorMode i just included Setting (now Settings) there to test incase
Alexicon
Alexicon2y ago
what part did you change? You changed the source to "properties:Settings.Default"
Dawnbomb
Dawnbomb2y ago
oh I didn't realize i had done that as i tested various things but still errors
Dawnbomb
Dawnbomb2y ago
Dawnbomb
Dawnbomb2y ago
i now realize i was missing an s on both of them so that wasn't from testing...fuk
Alexicon
Alexicon2y ago
your still getting that most recent error?
Dawnbomb
Dawnbomb2y ago
oh i just had to build
Alexicon
Alexicon2y ago
: )
Dawnbomb
Dawnbomb2y ago
I will ask for more help another time surely, also oh boy is getting human help so much faster then 5 hours of google when you don't know what your looking for in the depths of code terms being so specific but thank you!!! (I will close this post in a bit, just leaving it open to make sure you read the thank you)
Alexicon
Alexicon2y ago
no problem
Want results from more Discord servers?
Add your server
More Posts