Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 791595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:51:46+00:00 2026-05-14T21:51:46+00:00

The following is a snippet from a xaml defining a DataGrid in a Control,

  • 0

The following is a snippet from a xaml defining a DataGrid in a Control, defining a template selector.

<DataGrid.Resources>
    <selector:CurrencyColorSelector x:Key="currencyColorSelector">
        <selector:CurrencyColorSelector.NegativeTemplate>
            <DataTemplate>
                <TextBlock Text="{Binding Balance, StringFormat=n}" Background="Red"/>
            </DataTemplate>
        </selector:CurrencyColorSelector.NegativeTemplate>
        <selector:CurrencyColorSelector.NormalTemplate>
            <DataTemplate>
                <TextBlock Text="{Binding Balance, StringFormat=n}"/>
            </DataTemplate>
        </selector:CurrencyColorSelector.NormalTemplate>
    </selector:CurrencyColorSelector>
</DataGrid.Resources>

Now, an error is thrown: “Unknown build error, ‘Path cannot be null. Parameter name: path Line 27 Position 79.'” (Compiler or xaml validation error).

Edit

After a reboot of Visual Studio 2010 I get the following:

The tag ‘CurrencyColorSelector’ does not exist in XML namespace ‘clr-namespace:EveTrader.Wpf.Selectors;assembly=EveTrader.Wpf’. Line 27 Position 18.

Which makes it even weirder, as I even have intelisense for the class.


I have no idea where this Path comes from, neither does my example show anything of it. If you doubleclick the error, it points to the end of <selector:CurrencyColorSelector x:Key="currencyColorSelector"> (line 27).

Did anybody encounter such a problem and has a solution for it? The example was from here: http://www.wpftutorial.net/DataGrid.html (Row Details depending on the type of data)

Clarification

This is under .net 4.0. The Problem has to do with the CurrencyColorSelector, as the Templates themselves work fine if used in the DataGridTemplateColumn on their own. CurrencyColorSelector derives from DataTemplateSelector.

CurrencyColorSelector

namespace EveTrader.Wpf.Selectors
{
    public class CurrencyColorSelector : DataTemplateSelector
    {
        public DataTemplate NegativeTemplate { get; set; }
        public DataTemplate NormalTemplate { get; set; }

        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            var data = item as DisplayWallets;

            if (data == null)
                return base.SelectTemplate(item, container);

            if (data.Balance < 0m)
                return NegativeTemplate;
            return NormalTemplate;
        }
    }
}

DisplayWallets

public class DisplayWallets
{
    public string Name { get; set; }
    public decimal Balance { get; set; }
}

Xaml selector definition

<UserControl x:Class="EveTrader.Wpf.WalletsView"
             xmlns:selector="clr-namespace:EveTrader.Wpf.Selectors;assembly=EveTrader.Wpf">
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T21:51:47+00:00Added an answer on May 14, 2026 at 9:51 pm

    Okay, I fixed it. The problem was the definition of selector:

    xmlns:selector="clr-namespace:EveTrader.Wpf.Selectors;assembly=EveTrader.Wpf".

    As the type CurrencyColorSelector resides in the EveTrader.Wpf assembly, this definition created a circular reference which created the error – the compiler tried to compile the assembly EveTrader.Wpf, but because of the defition of selector, it tried to create EveTrader.Wpf first. This continued ad nauseam. The fix is simple: remove the assembly definition: xmlns:selector="clr-namespace:EveTrader.Wpf.Selectors".

    I fixed this problem after some hours of sleep after working through the night, which proves again, sleep is needed. Thanks for the help Igor anyway.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the following snippet, I am able to remove two key fields from a
The following snippet from RuntimeUtil.java from jlibs guarantees GC that garbage collection is done.
I have the following snippet from my code: switch ($extention) { case gif: $src
Given the following code snippet from inside a method; NSBezierPath * tempPath = [NSBezierPath
The following code snippet is from The Official GNOME 2 Developer's Guide : GMemChunk
From the book Groovy and Grails recipes I'm using the following code snippet: String
From this site: http://www.toymaker.info/Games/html/vertex_shaders.html We have the following code snippet: // transformations provided by
Hey all, the following is a snippet of code taken from the unix ptx
Please consider the following snippet from an implementation of the Interpreter pattern: public override
following snippet is from rails code def rescue_from(*klasses, &block) options = klasses.extract_options! unless options.has_key?(:with)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.