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

  • SEARCH
  • Home
  • 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 495297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:34:48+00:00 2026-05-13T05:34:48+00:00

Im new to wpf, and looking for good tutorials to help understand triggers better

  • 0

Im new to wpf, and looking for good tutorials to help understand triggers better but im not having much luck. So i thought I would seek some help here. Here is what im trying to do, i have a ScrollViewer that has a stack panel, in the code behind I browse a media folder and added MediaElements to the stackpanel using a foreach loop, what I want to do is when a user hovers over one of these, i want it to glow underneath it, I’m told triggers are the way to go, so here is what i have so far

foreach

                MediaElement newVideoPreview = new MediaElement(); 
                newVideoPreview.Width = 125;
                newVideoPreview.Stretch = Stretch.Uniform; 
                newVideoPreview.Margin = new Thickness(5, 5, 5, 5); 
                newVideoPreview.Volume = 0;

                Trigger trig = new Trigger();
                trig.Property = IsMouseOverProperty;
                trig.Value = true;
                Style style = new Style();
                style.TargetType = newVideoPreview.GetType();
                style.Triggers.Add(trig);
                Setter set  = new Setter();

                OuterGlowBitmapEffect glow = new OuterGlowBitmapEffect();
                glow.GlowColor = Color.FromRgb(0, 0, 205);
                glow.GlowSize = 10;
                set.Value = glow; // <- Crash house
                set.Property = EffectProperty;
                style.Setters.Add(set);
                newVideoPreview.Style = style;

as you can see, i get an invalid argument exception when i try to set the setter.value, im looking for suggestions on how to fix this or do it better, or better tutorials…Thanks for any help

p.s I am using VS2010 beta 2

Update Ive tried this too this dosent work….

<UserControl x:Class="WiiDSUKiosk.WiiFriendlyScrollViewer"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
         mc:Ignorable="d" 
         d:DesignHeight="300" d:DesignWidth="300">
<Grid>
    <Grid.Resources>
        <Style TargetType="{x:Type UIElement}">
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="true">
                    <Setter Property="BitmapEffect">
                        <Setter.Value>
                            <OuterGlowBitmapEffect GlowColor="Navy" GlowSize="10"/>
                        </Setter.Value>
                    </Setter>
                </Trigger>
            </Style.Triggers>
        </Style>
    </Grid.Resources>
    <ScrollViewer Name="wiiFriendlyScrollViewer" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden"
                  MouseMove="wiiFriendlyScrollViewer_MouseMove" >

        <StackPanel Name="stackPanelContent" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden">
        </StackPanel>
    </ScrollViewer>
</Grid>

  • 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-13T05:34:48+00:00Added an answer on May 13, 2026 at 5:34 am

    this is a lot easier to do in xaml, trying to manipulate this stuff in code is a headache.

    there is some code in this unrelated article about items control generators that will add the glow when an item is selected in a list box. ( a little more than half way down )

    here is the ms example it uses triggers to glow anything that has focus. ( it is a lot easier to understand )

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

Sidebar

Related Questions

I am fairly new to WPF and I am having a problem with inheriting
A bit new with WPF...It seems like not matter what I change with horizontal
Ok... I'm new to WPF, but I kind of know how to do things
I new to WPF C# and I'm looking for some direction. I have a
I started a new WPF project in VS2008 and then added some code to
I'm VERY new to WPF, and still trying to wrap my head around binding
I'm new to WPF and data binding so hopefully I can explain the problem
I'm new to WPF and come from a WinForms background and have a fairly
Hello there and Merry Christmas !!! I am new to WPF and I am
Learning WPF nowadays. Found something new today with .Net dependency properties. What they bring

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.