嗨,我最近发现您可以使用 WPF 中的组件并添加到 windows 窗体中,只需创建它们,然后将其添加到窗体中作为元素主机
所以我想要做的是使用 MediaElement 创建一个视频播放器,我也知道你可以使用 Direct X 或使用 Windows Media 播放器为此我想自定义制作一些控件所以这是我的问题
当我尝试将媒体元素添加到我的 Windows 窗体中时,它给了我这个错误
这是我的 mediaelement wpf 代码
<UserControl x:Class="Videoplayer_2._0.MediaPlayer"
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"
xmlns:local="clr-namespace:Videoplayer_2._0"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<MediaElement x:Name="mediaElement" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
</Grid>
</UserControl>
所以添加 mediaElement 不起作用或者我做错了什么,而且我在表单中添加了一个 WPF 滑块也只是说因为我不知道它是否会影响它