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

Ask A Question

Stats

  • Questions 256k
  • Answers 256k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You could try parallelism since it doesn't look like you… May 13, 2026 at 10:30 am
  • Editorial Team
    Editorial Team added an answer I'm not sure what I was thinking, too late in… May 13, 2026 at 10:30 am
  • Editorial Team
    Editorial Team added an answer I wouldn't like to claim particular knowledge here, but there's… May 13, 2026 at 10:30 am

Related Questions

I'm looking to set the background of a column in a WPF GridView. Many
I currently do all development work in VB.NET 2008, winforms; but within 18 months
I really want to create a stunning-looking GUI desktop application that looks like, for
Basically I'm going to go a bit broad here and ask a few questions
Im looking for a control like the DataForm which is new in Silverlight 3

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.