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 4346078
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T12:07:32+00:00 2026-05-21T12:07:32+00:00

I have a WPF 4 and VB.net 2010 project. I am playing videos in

  • 0

I have a WPF 4 and VB.net 2010 project. I am playing videos in a single mediaelement. This is what I need to do:

When the window first opens, I have the first video play just fine. However, it is after this video plays that I run into trouble figuring out how to do the following.

  1. I need the video source to change immediately following a single play through of any video, and I need this video (henceforth referred to as an “ambient” video) to loop forever.

  2. When a certain event happens, I need to change the video source again, have it play once through, and then go back to looping ambient video in step 1.

Here is the rub, however. Many of the video triggers are inside of If-Then or Select Case statements in code behind, so I’m not exclusively using simple WPF events such as “MouseUp” or “MouseEnter”.

Also, all videos must play in the same mediaelement, for performance reasons.

Thank you in advance!

How do I do this?

  • 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-21T12:07:33+00:00Added an answer on May 21, 2026 at 12:07 pm

    The Source of the media element is a DependencyProperty, as such any changes to it will be immediately reflected in the UI.

    If you combine this with the MediaEnded event that is fired, you can set the Source and your problem is solved.

    When you hit the triggers in code, you can either call a method or fire an event. You will have to use some semblance of a State Pattern to deal with the other logic. As an aside, check out Programming Without Ifs, it’s an awesome intro on how to avoid insane conditional logic.

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

Sidebar

Related Questions

I have a project with WPF 4/VB.net 2010. How do I begin a WPF
all,, I have a project that is built in VB.Net 2010 and WPF 4.
I have a WPF 4/VB.net 2010 project, and I'm trying to do a visual
This is my first ASP.Net project. I am used to WPF . I am
I have a WPF VB.NET project in Visual Studio 2008. For some reason, Visual
I have created a wpf vb.net project and am trying to set a simple
I have the problem when I create blank wpf .Net 3.5 project. Visual studio
I'm kinda new to WPF and .Net programming in general. I have downloaded this
I am using VB.NET 2010 (Visual Basic 2010 Express) on a WPF-based project. I
C#, Visual Studio 2010, dot net 4, WPF, Microsoft Ribbon I have a WPF

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.