Search code examples
c#wpfphotoshopdropshadow

using Global Light in Wpf


I am developing UI for a Wpf application. I have designs build by designer in Adobe Photoshop CS3. I am going through them and achieving the same in my project using WPF. In PhotoShop, while setting Drop Shadow, there is option to select Angle and there is a CheckBox for Use Global Light.

I got some reference for this. but I don't know how to achieve this in WPF. In WPF, I am not able to find any such option with DropShadowEffect. Anybody help me plz.


Solution

  • I don't believe there is any similar concept for a drop shadow effect. That being said, you could use style so create your own GlobalLight style that would be used by your controls.

    For example:

    <Grid>
      <Grid.Resources>
        <Style x:Key="GlobalLight" TargetType="TextBlock">
         <Setter Property="Effect">
           <Setter.Value>
            <DropShadowEffect BlurRadius="2" Direction="-90" Color="Black" ShadowDepth="1"/>
           </Setter.Value>
         </Setter>
          </Style>
        </Grid.Resources>
    
      <TextBlock Text="Drop shadow effect text" Style="{StaticResource GlobalLight}" />
    </Grid> 
    

    More examples of using the drop shadow effect can be found here.