Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5999453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:33:15+00:00 2026-05-23T00:33:15+00:00

i had some trouble generating WPF styles containing Triggers from C# code. Here’s the

  • 0

i had some trouble generating WPF styles containing Triggers from C# code.
Here’s the WPF code i want to generate trough C#.

<Style.Triggers>
    <Trigger Property="IsMouseOver" Value="true">
        <Setter Property="BitmapEffect">
            <Setter.Value>
                <OuterGlowBitmapEffect GlowColor="Gold" GlowSize="10" />
            </Setter.Value>
        </Setter>
    </Trigger>
</Style.Triggers>

I alredy tried to generate like this :

Style style = new Style();
Trigger trigger = new Trigger();
Setter setter = new Setter();

style.Triggers.Add(trigger);
trigger.Property = (DependencyProperty.Register("IsMouseOver", Type.GetType("IsMouseOver"), Type.GetType("Canvas"))); //Line not tested
//trigger.Setters.Add(new Setter(new BitmapEffect()); //Line not working

But i could not figure out how to use trigger.Setters with a BitmapEffect

Thanks you in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T00:33:16+00:00Added an answer on May 23, 2026 at 12:33 am

    The direct translation would be:

    OuterGlowBitmapEffect effect = new OuterGlowBitmapEffect();
    effect.GlowColor = Colors.Gold;
    effect.GlowSize = 10;
    
    Setter setter = new Setter();
    setter.Property = UIElement.BitmapEffectProperty;
    setter.Value = effect;
    
    Trigger trigger = new Trigger();
    trigger.Property = UIElement.IsMouseOverProperty;
    trigger.Value = true;
    trigger.Setters.Add(setter);
    
    Style style = new Style();
    style.Triggers.Add(trigger);
    

    This can be cleaned up to:

    var effect = new OuterGlowBitmapEffect() {
        GlowColor = Colors.Gold,
        GlowSize = 10,
    };
    
    var setter = new Setter() {
        Property = UIElement.BitmapEffectProperty,
        Value = effect,
    };
    
    var trigger = new Trigger() {
        Property = UIElement.IsMouseOverProperty,
        Value = true,
        Setters = { setter },
    };
    
    var style = new Style() {
        Triggers = { trigger },
    };
    

    But this is based on your coding style.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've had some trouble forking of processes from a Perl CGI script when running
I use DropBox and I've had some trouble reaching to my files from other
I'm trying to generate some LaTeX code which from thereon should generate PDF documents.
I've recently had some trouble moving the location of the indexes folder (for the
For some reason I've always had trouble remembering the backwards/forwards compatibility guarantees made by
I had some code that ran commands through Runtime.getRuntime.exec(String) , and it worked on
I know that people have had some trouble with undefined CssClass values when using
I've had some trouble finding information about Apple's policies regarding in-app ads. I'm interested
Hi i am having some trouble passing variables/doing functions from other classes, Right now
I am having trouble uploading an image with JSP in Tomcat. I had some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.