WPF StringCollection + TextBox
ApplicationSetting: RenameSettings - System.Collections.Specialized.StringCollection - User - *wall of text"
<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... I'd like to bind it to a TextBox, Text, for viewing/editing. Following a similar patterns I've seen here and there:
I've tried TextBox, TextBlock, La开发者_如何学Cbel (only shows the word "(Collection)")... How can I bind this elegantly?
I'm an idiot... Switched to ListBox ItemsSource...
<ListBox Margin="12,129,12,12" Name="textBlock1"
ItemsSource="{Binding Source={StaticResource Settings}, Path=Default.RenameSettings, Mode=TwoWay}"/>
精彩评论