WPF effects inheritance.

Page 1 of 1

2 Replies - 4702 Views - Last Post: 07 September 2012 - 08:25 AM Rate Topic: -----

#1 _HAWK_  Icon User is online

  • Master(Of Foo)
  • member icon

Reputation: 1062
  • View blog
  • Posts: 4,138
  • Joined: 02-July 08

WPF effects inheritance.

Posted 06 September 2012 - 07:47 PM

I have moved to WPF. Incredible stuff! Anyway I have been playing with the Effects and was wondering if there was a way to have all controls of a certain type to inherit an Effect rather than add the effect node to each control in the XAML code. Rarely am I not able to research thing like this on my own. Thanks for any tips!
Is This A Good Question/Topic? 0
  • +

Replies To: WPF effects inheritance.

#2 bflosabre91  Icon User is offline

  • go sabres

Reputation: 105
  • View blog
  • Posts: 1,439
  • Joined: 22-February 08

Re: WPF effects inheritance.

Posted 07 September 2012 - 06:50 AM

Yeah, that where you could create a style for a certain control type, and then apply that style to the controls that you want to look like that. Here is a tutorial:

http://wpftutorial.net/Styles.html

you just need to add the effect to this simple example. If you want to apply that style to every instance of that control automatically, take a look at this example:

http://stackoverflow...rols-wpf-styles
Was This Post Helpful? 2
  • +
  • -

#3 _HAWK_  Icon User is online

  • Master(Of Foo)
  • member icon

Reputation: 1062
  • View blog
  • Posts: 4,138
  • Joined: 02-July 08

Re: WPF effects inheritance.

Posted 07 September 2012 - 08:25 AM

Exactly, I knew they would have a plan for that. Thanks!

Finished product!

    <window.Resources>
        <Style  TargetType="TextBox" BasedOn="{StaticResource {x:Type TextBox}}">
            <Setter Property="Effect">
                <Setter.Value>
                    <DropShadowEffect
                              Direction="315"
                              Color="Black" 
                              RenderingBias="Quality"
                              ShadowDepth="3" />
                       
                </Setter.Value>
            </Setter>
         </Style>
    </window.Resources>

This post has been edited by _HAWK_: 07 September 2012 - 08:50 AM

Was This Post Helpful? 1
  • +
  • -

Page 1 of 1