【发布时间】:2016-03-14 08:12:23
【问题描述】:
您好,我最近发现您可以使用 WPF 中的组件并添加到 windows 窗体中,只需创建它们,然后将其作为元素主机添加到窗体中
所以我想要做的是使用 MediaElement 创建一个视频播放器,我也知道你可以使用 Direct X 或使用 Windows Media 播放器,我想自定义制作一些控件,所以这是我的问题
这是我的 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 滑块也只是说因为我不知道它是否会影响它
【问题讨论】:
-
你只需要重启 Visual Studio 我认为
-
哈哈它工作@Gopichandar谢谢
-
另外,请确保在 WPF 的
WindowsFormsHost中添加 winform 控件
标签: c# wpf windows-forms-designer elementhost