【发布时间】:2010-09-29 14:55:23
【问题描述】:
ApplicationSetting:RenameSettings - System.Collections.Specialized.StringCollection - 用户 - *文字墙"
<Application x:Class="app.App"
...
xmlns:properties="clr-namespace:app.Properties"
StartupUri="MainWindow.xaml">
<Application.Resources>
<properties:Settings x:Key="Settings" />
</Application.Resources>
</Application>
<Window x:Class="app.MainWindow"
...
xmlns:p="clr-namespace:app.Properties"
Height="{Binding Source={StaticResource Settings}, Path=Default.Height, Mode=TwoWay}" MinHeight="300"
...
>
<Window.Resources>
<p:Settings x:Key="settings" />
</Window.Resources>
<Grid DataContext="{StaticResource settings}">
<Menu ... ... />
<Label ... />
<TextBox Margin="12,129,12,12" Name="textBlock1"
Text="{Binding Source={StaticResource Settings}, Path=Default.RenameSettings, Mode=TwoWay}"/>
</Grid>
</Window>
StringCollection... 我想将它绑定到一个 TextBox、Text,以便查看/编辑。遵循我在这里和那里看到的类似模式:
我试过TextBox,TextBlock,Label(只显示单词“(Collection)”)...我怎样才能优雅地绑定它?
【问题讨论】:
标签: c# wpf binding application-settings