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

  • SEARCH
  • Home
  • 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 6238075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:08:47+00:00 2026-05-24T11:08:47+00:00

In SQL I can do this: Select Coalesce(Property1, Property2, Property3, ‘All Null’) as Value

  • 0

In SQL I can do this:

Select Coalesce(Property1, Property2, Property3, 'All Null') as Value
From MyTable 

If Property1, 2 and 3 are all null, then I get ‘All Null’

How do I do this in XAML? I tried the following, but no luck:

<Window.Resources>
    <local:Item x:Key="MyData" 
                Property1="{x:Null}"
                Property2="{x:Null}"
                Property3="Hello World" />
</Window.Resources>

<TextBlock DataContext="{StaticResource MyData}">
    <TextBlock.Text>
        <PriorityBinding TargetNullValue="All Null">
            <Binding Path="Property1" />
            <Binding Path="Property2" />
            <Binding Path="Property3" />
        </PriorityBinding>
    </TextBlock.Text>
</TextBlock>

The result should be ‘Hello World’ but instead it is ‘All Null’

I hope my question is clear.

  • 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-24T11:08:48+00:00Added an answer on May 24, 2026 at 11:08 am

    You’d have to build a custom IMultiValueConverter to do that and use a MultiBinding. PriorityBinding uses the first binding in the collection that produces a value successfully. In your case, the Property1 binding resolves immediately, so it’s used. Since Property1 is null, the TargetNullValue is used.

    A converter like this:

    public class CoalesceConverter : System.Windows.Data.IMultiValueConverter
    {
        public object Convert(object[] values, Type targetType, 
                object parameter, System.Globalization.CultureInfo culture)
        {
            if (values == null)
                return null;
            foreach (var item in values)
                if (item != null)
                    return item;
            return null;
        }
    
        public object[] ConvertBack(object value, Type[] targetTypes, 
                object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
    

    And MultiBinding like this:

    <Window.Resources>
        <local:Item x:Key="MyData" 
                    Property1="{x:Null}"
                    Property2="{x:Null}"
                    Property3="Hello World" />
        <local:CoalesceConverter x:Key="MyConverter" />
    </Window.Resources>
    
    <TextBlock DataContext="{StaticResource MyData}">
        <TextBlock.Text>
            <MultiBinding Converter="{StaticResource MyConverter}">
                <Binding Path="Property1" />
                <Binding Path="Property2" />
                <Binding Path="Property3" />
            </MultiBinding>
        </TextBlock.Text>
    </TextBlock>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In T-SQL, you can do this: SELECT ProductId, COALESCE(Price, 0) FROM Products How do
we can use SQL just like this: SELECT * FROM student WITH(NOLOCK); How can
This is from a sql script. What tool can generate this? Thanks --USE [MY_TABLE]
Please show me how I can modify this SQL select to use pivot instead
I want to generate SQL like this: SELECT coalesce(max(a.a_index) + 1, 0) as a_index
I have this sql: SELECT a.member_id, b.date, b.type, d.K_id, d.title, a.login FROM members as
I have this sql: SELECT m.member_id, m.login, p.type FROM permissions p INNER JOIN members
I want to prepend text to sql select, I can do this: SELECT (1328724983-time)/60/60
MySQL has this incredibly useful yet proprietary REPLACE INTO SQL Command. Can this easily
Querying a Nested Set Model table , here's the SQL... how can this be

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.