4

I am using Visual C# Studio 2010 Express and I have oakward problem. I wanted to bind few TextBoxes to application Settings. I've followed Paul Sheriff's solution Paul Sheriff's solution. It works only in visual designer - I can't run the app, cause i got:

XmlParseException 'Provide value on 'System.Windows.StaticResourceExtension' threw an exception.

How is it possible, that it's working in visual designer (values are presented in TextBoxes correctly) but there is a XmlParseException?

App.xaml:

<Application.Resources>
    <ObjectDataProvider x:Key="odpSettings" ObjectType="{x:Type setts:Settings}" />
</Application.Resources>`

The setts namespace is defined as xmlns:setts="clr-namespace:DbCopier.Properties"

My view:

<TextBox
    Text="{Binding Source={StaticResource odpSettings}, Path=Default.DbName}"
    Width="150" />
4

1 回答 1

0

我知道了!

InnerException 非常令人困惑。这都是关于设置文件中的属性范围。我注意到它已更改为Application,因此它是只读的。我只是将其更改为User可写。如此简单却又如此令人讨厌的错误。

于 2012-06-18T11:40:45.873 回答