gpt4 book ai didi

c# - 命名空间中不存在控件

转载 作者:行者123 更新时间:2023-12-04 16:57:32 30 4
gpt4 key购买 nike

我正在尝试使用 MediaUriElement在自定义 ( WPFMediaKit ) 中。

我已经将它添加到命名空间中;

xmlns:controls="clr-namespace:WPFMediaKit.DirectShow.Controls;assembly=WPFMediaKit"

然后我尝试访问它;
<Grid>
<controls:MediaUriElement x:Name="mediaUriElement" />
</Grid>

但是我只是收到一个错误:名称 MediaUriElement 在这个命名空间中不存在。 VS 确实给了我一个建议,让我在打字时使用它;

enter image description here

如何将其正确添加到我的项目中?

最佳答案

我已经试过了,它奏效了。我所做的:

  • Framework 4.5 切换项目至 Framework 4.0
  • 添加了诸如 DirectShowLib-2005.dll 的引用文献和 WPFMediaKit.dll到项目
  • 声明的 xaml 命名空间 xmlns:controls="clr-namespace:WPFMediaKit.DirectShow.Controls;assembly=WPFMediaKit"像那样:
    <Window x:Class="ExcelExportWpfApplication.MainWindow"
    ... The code omitted for the brevity...
    xmlns:controls="clr-namespace:WPFMediaKit.DirectShow.Controls;assembly=WPFMediaKit"
    xmlns:vm="clr-namespace:ExcelExportWpfApplication.ViewModel"
    mc:Ignorable="d"
    Title="MainWindow" Height="550" Width="525"
    WindowStartupLocation="CenterScreen">
  • 并且只是用 xaml 写的:
    <controls:MediaUriElement Grid.Row="2"/>
  • 没有错误
  • 关于c# - 命名空间中不存在控件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36542698/

    30 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com