Binding Properties.Settings to Textbox fails

Posted by user268098 on Stack Overflow See other posts from Stack Overflow or by user268098
Published on 2012-06-18T21:02:49Z Indexed on 2012/06/18 21:16 UTC
Read the original article Hit count: 229

Filed under:
|
|
|

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:

  1. Create a WPF project "Exp1" with Visual Studio Express 2010.
  2. Set one key named "TextFromSettings" to the value "Some Text from Setting".
  3. Add the attribute xmlns:p="clr-namespace:Exp1.Properties;assembly=Exp1" to the tag.
  4. Add Text="{Binding Path=TextFromSettings, Mode=TwoWay, Source={x:Static p:Settings.Default}}" to the tag

Now, 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?

enter image description here

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET