Click here to Skip to main content
15,888,011 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am trying to use a Windows Media Player Control in WPF

What I have tried:

references in ther WPF project to System.Windows.Forms added.
added to main form to access libraries:
xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
xmlns:ax="clr-namespace:AxWMPLib;assembly=AxInterop.WMPLib"

I get :
Warning BC40056 Namespace or type specified in the Imports 'AxWMPLib' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.
ALSO:
Severity Code Description Project File Line Suppression State
Error Assembly 'AxInterop.WMPLib' was not found. Verify that you are not missing an assembly reference. Also, verify that your project and all referenced assemblies have been built.

CODE:
<window x:class="MainWindow" xmlns:x="#unknown">
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
xmlns:ax="clr-namespace:AxWMPLib;assembly=AxInterop.WMPLib"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApplication1"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<grid>


Posted
Updated 2-May-16 8:04am

1 solution

Why? Look at this class System.Windows.Media.MediaPlayer, which is a part of WPF:
MediaPlayer Class (System.Windows.Media)[^].

I hardly can imagine that the use of the direct use of AxWMPLib component can ever give you any benefits over System.Windows.Media.MediaPlayer. Try this element first. If you have any reasons to consider it as insufficient (oh, there are a lot of such reasons), you should better resort to some other components, not related to notoriously feature-poor Microsoft player. First of all, it could be a component based on VideoLAN (VLC).

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900