簡體   English   中英

將MediaElement添加到Windows窗體錯誤C#

[英]Adding MediaElement to windows form error C#

嗨,我最近發現您可以使用WPF中的組件並將其添加到Windows窗體中,只需創建它們,然后再將其作為元素主機添加到窗體中

所以我想做的是使用MediaElement創建一個視頻播放器,我也知道您可以為此使用Direct X或Windows Media Player,我想在其中自定義制作一些控件,所以這是我的問題

當我嘗試在Windows窗體中添加媒體元素時,出現此錯誤 在此處輸入圖片說明

這是我的調解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。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM