Reputation: 9803
I would like to define a key & value in Settings.settings and bind the value by declaration in the XAML (not in the code behind by command).
Here's what I've been trying in vain:
xmlns:p="clr-namespace:Exp1.Properties;assembly=Exp1"
to the tag.Text="{Binding Path=TextFromSettings, Mode=TwoWay, Source={x:Static p:Settings.Default}}"
to the tagNow, the preview window shows the text, however, the compiler fails:
"Error 1 Cannot find the type 'Settings'. Note that type names are case sensitive."
Where am I going wrong?
Upvotes: 0
Views: 715
Reputation: 184376
Drop the ;assembly=Exp1
it's not allowed for references to the current assembly.
If anything it should be ;assembly=
, see MSDN.
assembly can be omitted if the clr-namespace referenced is being defined within the same assembly as the application code that is referencing the custom classes. Or, an equivalent syntax for this case is to specify assembly=, with no string token following the equals sign.
Upvotes: 1