none
The tag does not exist in the XML namespace. It does .... really!

    Question

  • I defined a data  binding between items in a ListBox and an array (Observable Collection) of a user defined data type. When a property on one of the objects in the Array changes state, I want to visually change several visual elements of the item in the list box. Sounds like a job for WPF DataTriggers. So I defined the following:

     

    Code Snippet

    <DataTrigger Binding="{Binding Path=PinningProgressVisibility}">

      <DataTrigger.Value>

        <profman:ProgressVisibility>Collapsed</</profman:ProgressVisibility>

      </DataTrigger.Value>

      <Setter TargetName="AppPinnedProgress" Property="Visibility" Value="Collapsed" />

      <Setter TargetName="AppText" Property="Visibility" Value="Visible" />

      <Setter TargetName="AppSizeIndicator" Property="Background" Value="Green" />

    </DataTrigger>

    <DataTrigger Binding="{Binding Path=PinningProgressVisibility}">

      <DataTrigger.Value>

        <profman:ProgressVisibility>Collapsed</profman:ProgressVisibility>

      </DataTrigger.Value>

      <Setter TargetName="AppPinnedProgress" Property="Visibility" Value="Visible" />

      <Setter TargetName="AppText" Property="Visibility" Value="Collapsed" />

      <Setter TargetName="AppSizeIndicator" Property="Background" Value="Gray"/>

    </DataTrigger>

     

    One thing to note is that the namespace profman is defined like this:

     

    Code Snippet

    xmlns:profman="clr-namespace:SmartPinLib.ProfileManager"

     

    I am basically using the property ProgressVisibility as a stand-in for System.Windows.Visibility. However, I was not able to compile when I used System.Windows.Visibility for that property. The XAML compiler would complain saying: "The tag Visibility is not defined in the namespace System.Windows". As I have things now, it says about the same thing: "The tag ProgressVisibilty does not exist in the namespace SmartPinLib.ProfileManager"

     

    It is not until I define my property type ProgressVisibility in the local (the application's namespace), that I can actually get this to compile. It seems like I should be able to use types defined in a library whether that library is a user library or a system library? No? Am I doing something wrong?

    Monday, April 16, 2007 5:14 AM

Answers

  • Hi there

    It sounds like your issue comes about due to the way you are defining your namespace. You need to include the assembly name in your xml namespace definition, e.g.

    Code Snippet

    xmlns:profman="clr-namespace:SmartPinLib.ProfileManager;assembly=SmartPinLib"


    Let me know if that doesn't work

    Thanks
    Neil
    Monday, April 16, 2007 11:41 AM

All replies

  • Hi there

    It sounds like your issue comes about due to the way you are defining your namespace. You need to include the assembly name in your xml namespace definition, e.g.

    Code Snippet

    xmlns:profman="clr-namespace:SmartPinLib.ProfileManager;assembly=SmartPinLib"


    Let me know if that doesn't work

    Thanks
    Neil
    Monday, April 16, 2007 11:41 AM
  • Thanks Neil,

    That did solve my problem. I feel a little boneheaded for not knowing that.

    Lou
    Monday, April 16, 2007 4:41 PM
  • Hi there

    It sounds like your issue comes about due to the way you are defining your namespace. You need to include the assembly name in your xml namespace definition, e.g.

    Code Snippet

    xmlns:profman="clr-namespace:SmartPinLib.ProfileManager;assembly=SmartPinLib"


    Three years later...

    I'm using Visual Studio 2008, and see this error regularly.

    It's often caused by subtle errors in my code... well... anywhere.

    One thing I've noticed when developing in VS2008 with WPF, rather than ASP.Net or C# is that when you have a subtle bug in your WPF code, the errors you receive sometimes give you absolutely no clue as to where the error is coming from.

    VS2008 will often just comes up with an incorrect "The tag does not exist in the XML namespace" error, even though the tag is absolutely correct. Earlier today, I had this problem, imported the entire solution into VS2010, and it compiled perfectly.

    No bug.
    But from there, I could work out where the "actual" problem was.

    So, before you spend hours looking at Tags, Namespaces and so on, check for any other clues as to problems in your code.

    Wednesday, July 28, 2010 3:11 PM
  • Yes indeed Mike,

    I've spent an hour chasing down this issue this morning...looking at Tags, Namespaces and so on.

    Then I simply commented out code so that the thing compiled...Then put in the XAML reference that I was fighting.  I got a new error!

    "Because 'xxx' is implemented in the same assembly, you must set the x:Name attribute rather than the Name attribute"

    Well...why didn't you tell me that to start with!

    Bob Rundle

     


    Bob Rundle
    Thursday, November 04, 2010 2:11 PM