问题描述
我正在尝试在WPF中使用Windows Media Player控件
我尝试过:
在WPF项目中引用System.Windows.Forms添加。
添加到主窗体中以访问库:
xmlns:wf = clr-namespace:System.Windows.Forms; assembly = System.Windows.Forms
xmlns:ax =clr-namespace:AxWMPLib; assembly = AxInterop.WMPLib
我得到:
警告BC40056 Imports'AxWMPLib'中指定的命名空间或类型不包含任何公共成员或无法找到。确保定义了名称空间或类型,并且至少包含一个公共成员。确保导入的元素名称不使用任何别名。
另外:
严重性代码描述项目文件行抑制状态
错误未找到程序集AxInterop.WMPLib。验证您没有错过程序集引用。此外,验证是否已构建项目和所有引用的程序集。
代码:
< window x:class =MainWindowxmlns: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 =MainWindowHeight =350Width =525>
< grid>
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 :
WarningBC40056Namespace 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:
SeverityCodeDescriptionProjectFileLineSuppression State
ErrorAssembly '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>
推荐答案
这篇关于在WPF中使用Windows Media Player控件(visual basic)(vs2015)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!