4
私はリストボックスであるアイテムテンプレートのリストボックスを持っています。内部リストボックスの "フォアグラウンド"プロパティをメインリストボックスの "フォアグラウンド"プロパティと同じに設定しようとしています。これは失敗しています。以下はコードスニペットです。ここでは、Foreground = "{TemplateBinding Foreground}"は効果がありません。TemplateBinding "Foreground"が機能しません
<ListBox x:Name="GroupListBox" Grid.Column="1" Grid.Row="1" Style="{StaticResource ListBoxStyle1}" Visibility="Collapsed"
BorderBrush="Transparent" Background="Transparent" Foreground="{Binding WebForeground}">
<ListBox.ItemTemplate>
<DataTemplate x:Name="test">
<StackPanel Orientation="Horizontal" >
<!--<TextBlock Text="{Binding Rank}" FontFamily="Arial" FontSize="13" TextDecorations="Underline" TextWrapping="Wrap" Width="115" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,15,0,0"/>-->
<ListBox x:Name="SubGroupListBox" ItemsSource="{Binding InnerList }" ItemTemplate="{StaticResource ItemTemplateKey1}"
ItemsPanel="{StaticResource ItemsPanelKey}" Style="{StaticResource ListBoxStyle1}"
BorderBrush="Transparent" Background="Transparent" Foreground="{TemplateBinding Foreground}">
</ListBox>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>