I'm trying to bind via xaml an app.config value to a control. Here's the code:
//App.config:
<appSettings>
<add key="SoundFile" value="C:\\Windows\\Media\\Windows Hardware Fail.wav"/>
</appSettings>
//window.xaml
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:properties="clr-namespace:MfClient.Properties">
...
<SoundPlayerAction Source="{Binding Source={x:Static p:Settings.Default},Path=SoundFile}"/>
This gives this error:
Error 44 Unknown build error, 'Key cannot be null. Parameter name: key Line 30 Position 56.'
If I remove the binding everything turns out to be ok:
<SoundPlayerAction Source="C:\Windows\Media\Windows Hardware Fail.wav" />
In order to bind (w/o the two way approach that I don't need), I've followed this and this other threads.
What am I getting wrong?