3

私のコードでは、SurfaceListBox に DataTemplate を作成しました。スタック パネルとスタック パネル内のテキスト ブロックにドロップ シャドウを追加しました。実行すると、テキスト ブロックのドロップ シャドウが、テキストの個々の文字ではなく、テキスト ブロックの UI 要素自体に表示されます。なぜこれが起こっているのか、それを修正する方法があるのだろうかと思っているので、テキストにドロップ シャドウが表示されます。

<DataTemplate>
    <StackPanel Background="WhiteSmoke" Height="190" Width="190">      
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="140"/>
                <RowDefinition Height="50"/>
            </Grid.RowDefinitions>
            <Image VerticalAlignment="Top" HorizontalAlignment="Center" Height="140" Width="140" Stretch="Fill" Source="{Binding ImagePath}" />
            <TextBlock Grid.Row="1" Text="{Binding Name}" Background="#9FCC19" Width="190" Height="50" TextAlignment="Center" VerticalAlignment="Center" Foreground="WhiteSmoke" 
                                               FontFamily="Segoe" FontSize="20" >
                 <TextBlock.Effect>
                     <DropShadowEffect ShadowDepth="2" RenderingBias="Performance"/>
                 </TextBlock.Effect>
             </TextBlock>
         </Grid>
         <StackPanel.Effect>
             <DropShadowEffect ShadowDepth="2"/>
         </StackPanel.Effect>
    </StackPanel>
</DataTemplate>
4

1 に答える 1