2
votes

I am quite new to WPF and am having a hard time with an annoying error message. Here are my steps:

  1. Create a new WPF application in Visual Studio 2015. This is the default xaml that is generated for MainWindow (this works fine):

    <Window x:Class="Skype_Utility.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:Skype_Utility"
        Title="MainWindow" Height="300" Width="300">
    
        <Grid>
        </Grid>
    </Window>
    
  2. Notice the first 2 lines:

    <Window x:Class="Skype_Utility.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    
  3. Next, I grabbed some xaml from here, because I am trying to add an auto-complete textbox to the project:

    <Window x:Class="Skype_Utility.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml "
            xmlns:ac="clr-namespace:WpfAutoComplete.Controls;assembly=WpfAutoComplete" 
            Title="Autocomplete Text Box Project"  
            Height="300" Width="300"> 
    
        <Grid> 
    
            <StackPanel> 
    
                <Label Content="This is an Autocomplete Textbox" /> 
    
                <ac:TextBoxAutoComplete Name="autoTxtBoxEng" 
                    SearchDataProvider="{Binding Path=MySearchProviderEng}"  
                    SelectedListBoxValue="{Binding Path=PhraseNumber, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
                    WatermarkText="Type in filtering text here..."/>  
    
            </StackPanel>
    
        </Grid>
    
    </Window>
    

However, when I place their xaml into my project, I get this error message:

The property "Class" does not exist in the "http://schemas.microsoft.com/winfx/2006/xaml " namespace.

Even though those are the exact same lines present in the default code, and there was no error given then...

How can Visual studio complain about this line even though it is literally exactly the same as the first couple of lines that were auto-generated? I have no clue how to progress with this and would really appreciate any advice!

My only thoughts on this really are that there must be some line occurring after the warning which is causing this, but in that case it is a very unhelpful error message!


I am unable to build or run my project due to the errors present:

The name "TextBoxAutoComplete" does not exist in the namespace "clr-namespace:WpfAutoComplete.Controls;assembly=WpfAutoComplete".


The property "Class" does not exist in the "http://schemas.microsoft.com/winfx/2006/xaml " namespace.


The property 'Class' does not exist in XML namespace 'http://schemas.microsoft.com/winfx/2006/xaml '.

1
Does it run or is this an actual compiler error?H.B.
(Usually the visual designer has some issues that cause errors that are not even there, and the application compiles and runs anyway)H.B.
Build fails and I also can't run it due to the error. There are also some other errors displayed which I will add to my question nowBassie
The other errors might be the issue. They also can lead to ghost errors because the build failed at a previous step.H.B.
@H.B. I added the other errors. I actually managed to get rid of the first 2 by adding a reference to WpfAutoComplete, but it still complains about the Class property, which seems ridiculous ...Bassie

1 Answers

4
votes

There is a space char too much in the end of the xmlns:x:

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml " <--- Remove the last char after xaml

so it becomes:

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"