1

I have this code to realize the inner shadow.

Somehow it includes the TextBlock and etc. I don't need it. I need ONLY INNER SHADOW.

It is near the problem described here but I have the inner shadow...

So I want to keep the inner shadow but don't apply it to fonts and etc.

Please help me to fix it. Thank you!

 <DataTemplate x:Key="RSSItemTemplate">
            <Border Background="LightGray" BorderBrush="DarkGray" Margin="0,0,0,5" BorderThickness="1" ClipToBounds="True">
                <Border Background="Transparent" BorderBrush="Black" BorderThickness="1" Margin="-2">
                    <Border.Effect>
                        <DropShadowEffect ShadowDepth="0" BlurRadius="5" />
                    </Border.Effect>
                    <Grid>
                        <StackPanel Orientation="Vertical" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                            <Image>
                            </Image>
                            <StackPanel Orientation="Vertical" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                    <TextBlock Text="{Binding Path=PublishDate}" Margin="0,0,5,0" />
                                    <TextBlock Text="{Binding Path=Title}"  TextWrapping="Wrap" />
                                </StackPanel>
                                <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                    <TextBlock Text="{Binding Path=Description}" Margin="0,5,0,0" TextWrapping="Wrap" />
                                </StackPanel>
                            </StackPanel>
                        </StackPanel>
                    </Grid>
                </Border>
            </Border>
        </DataTemplate>
    </UserControl.Resources>

    <Grid>
        <ItemsControl x:Name="MainRoot"   ItemTemplate="{StaticResource RSSItemTemplate}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
    </Grid>
Community
  • 1
  • 1
NoWar
  • 36,338
  • 80
  • 323
  • 498

1 Answers1

2

Try to modify it like this:

<DataTemplate x:Key="RSSItemTemplate">
        <Border Background="LightGray" BorderBrush="DarkGray" Margin="0,0,0,5" BorderThickness="1" ClipToBounds="True">
                <Grid>
                    <Border Background="Transparent" BorderBrush="Black" BorderThickness="1" Margin="-2">
                        <Border.Effect>
                            <DropShadowEffect ShadowDepth="0" BlurRadius="5" />
                        </Border.Effect>
                    </Border>
                    <StackPanel Orientation="Vertical" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                        <Image>
                        </Image>
                        <StackPanel Orientation="Vertical" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                <TextBlock Text="{Binding Path=PublishDate}" Margin="0,0,5,0" />
                                <TextBlock Text="{Binding Path=Title}"  TextWrapping="Wrap" />
                            </StackPanel>
                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                <TextBlock Text="{Binding Path=Description}" Margin="0,5,0,0" TextWrapping="Wrap" />
                            </StackPanel>
                        </StackPanel>
                    </StackPanel>
                </Grid>
        </Border>
    </DataTemplate>
    <!-- the rest of the code here -->

It seems to work as you described, having the inner shadow of the border but without affecting the elements inside.

Lukasz M
  • 5,635
  • 2
  • 22
  • 29