我正在疯狂问候!
我想知道,在将对象绑定到ItemsControl时,如何使用de ItemsSource中的当前路径将文本框绑定到LocalizedStrings?
代码将澄清,我希望:
<ItemsControl ItemsSource="{Binding Hours}" VerticalAlignment="Top">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid VerticalAlignment="Top">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="125" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="{Binding Path=LocalizedResources.DayName, Source={StaticResource LocalizedStrings}}" Style="{StaticResource App_Content_Grid_Bold}" HorizontalAlignment="Left" />
<TextBlock Grid.Column="1" Text="{Binding Description}" Style="{StaticResource App_Content_Grid_Subtle}" FontSize="20" Foreground="Black" HorizontalAlignment="Right" />
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
问题是,LocalizedStrings中不存在DayName,但它的值是。 在应用绑定本身之前,如何将其值解析到此绑定上下文中?
类似于:{Binding Path=LocalizedResources.[DayName], Source={StaticResource LocalizedStrings}}
?