1

I'm attempting to use the MediaUriElement in the custom (WPFMediaKit).

I've added it into the namespace like so;

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

and then I have tried to access it;

<Grid>
    <controls:MediaUriElement x:Name="mediaUriElement" />
</Grid>

however I just get an error: The name MediaUriElement does not exist in this namespace. VS does give me a suggestion to use it when I am typing though;

enter image description here

How can I correctly add this into my project?

CBreeze
  • 2,925
  • 4
  • 38
  • 93
  • may this helps you : http://stackoverflow.com/questions/14665713/the-name-does-not-exist-in-the-namespace-error-in-xaml – sujith karivelil Apr 11 '16 at 07:54
  • @un-lucky unfortunately none of the answers seem to have fixed my issue – CBreeze Apr 11 '16 at 08:31
  • Is is because your project cannot compile or does it just bother you with the blue underline ? I have exact same scenario in some of my projects, but the project is compiling just fine, so I assumed that there was some bug in VS. – Nawed Nabi Zada Apr 11 '16 at 08:42
  • @NawedNabiZada It wouldn't bother me at all, however the project won't compile which is the issue here – CBreeze Apr 11 '16 at 08:50
  • Sometimes, if you have errors somewhere else in your code you will face same problem. Even if the problem isn't here, VS will indicate it as a problem here. Clean your solution, and rebuild it. Check the Error list, and fix all other errors, sometimes this kind of errors disappear when other errors are fixed. – Nawed Nabi Zada Apr 11 '16 at 08:55
  • Have you added `WPFMEdiaKit` dll to your project ? – StepUp Apr 11 '16 at 08:57
  • @StepUp I have added it as a reference yes – CBreeze Apr 11 '16 at 09:05
  • so, just do it as Nawed Nabi Zada said. Sometimes red rows happens, but it is not a reason to be scaried:). Just write your code without `IntelliSense`. – StepUp Apr 11 '16 at 09:08
  • @StepUp the program will not compile it isn't just a designer error – CBreeze Apr 11 '16 at 09:10

1 Answers1

0

I've tried and it is worked. What I've done:

  1. Switched project from Framework 4.5 to Framework 4.0
  2. Added references such as DirectShowLib-2005.dll and WPFMediaKit.dll to the project

  3. Declared xaml namespace xmlns:controls="clr-namespace:WPFMediaKit.DirectShow.Controls;assembly=WPFMediaKit" like that:

    <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">
    
  4. And just written in xaml:

    <controls:MediaUriElement Grid.Row="2"/>
    
  5. No errors

StepUp
  • 36,391
  • 15
  • 88
  • 148
  • @CBreeze feel free to ask any question. If you feel that my reply helps to you, then you can mark my reply as an answer to simplify future search of other people. Please, read this http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work – StepUp Apr 11 '16 at 14:05
  • @CBreeze it is really interesting why don't you upvote answers or assign as answer replies to your thread? If you upvote replies, you'll take more treat by others. – StepUp Apr 11 '16 at 14:07