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 605081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:06:28+00:00 2026-05-13T17:06:28+00:00

This is driving me NUTS!!! I have a ComboBox used to filter a query

  • 0

This is driving me NUTS!!!

I have a ComboBox used to filter a query by employee which works fine but only displays the employees first name. I want to use a MultiValueConverter to display the employees full name (This would be less urgent if we did not have 2 Mikes and 2 Daves)

Below is my working code and the IMultiValueConverter Class (With unnecessary formatting trimmed out for brevity). I have tried everything I can think of to get the MultiConverter to work but I have had no luck.

<ComboBox ItemsSource="{Binding Path=EmployeesFilter}" 
                       DisplayMemberPath="EmpFirstName"
                       SelectedValue="{Binding Path=EmployeeToShow, Mode=TwoWay}"/>

The ViewModel Properties it is bound to:

// This collection is used to populate the Employee Filter ComboBox
private ObservableCollection<Employee> employeesFilter;
public ObservableCollection<Employee> EmployeesFilter
{
    get {
            return employeesFilter;
        }
    set {
        if (employeesFilter != value)
        {
            employeesFilter = value;
            OnPropertyChanged("EmployeesFilter");
        }
    }
}

// This property is TwoWay bound to the EmployeeFilters SelectedValue
private Employee employeeToShow;
public Employee EmployeeToShow
{
    get {
            return employeeToShow;
        }
    set {
        if (employeeToShow != value)
        {
            employeeToShow = value;
            OnPropertyChanged("EmployeeToShow");
            QueryIssues(); // Requery with new employee filter
        }
    }
}

The IMultiValueConverter:

class StringsToFullNameMultiConverter : IMultiValueConverter
{
    public object Convert(object[] values, 
                          Type targetType, 
                          object parameter, 
                          System.Globalization.CultureInfo culture)
    {
        // I added this because I kept getting DependecyProperty.UnsetValue 
        // Passed in as the program initializes
        if (values[0] as string != null)
        {
            string firstName = (string)values[0];
            string lastName = (string)values[1];
            string fullName = firstName + " " + lastName;
            return fullName;
        }
        return null;
    }

    public object[] ConvertBack(object value, 
                                Type[] targetTypes, 
                                object parameter, 
                                System.Globalization.CultureInfo culture)
    {
        return null; 
    }
}

I tried a lot of different things but basically am using the following in the ComboBox

<ComboBox.SelectedValue>
     <MultiBinding Converter="{StaticResource StringsToFullNameMultiConverter}" 
                   Mode="OneWay" > 
           <Binding Path="EmpFirstName" />
           <Binding Path="EmpLastName"/>
     </MultiBinding>
</ComboBox.SelectedValue>

As it stands now the converter is called when the program initializes with the values set to DependencyProperty.UnsetValue. after that it is never called again, even when you select a name from the box. The names are still displayed as a first name.

Thanks for any help or pointers to good tutorials/samples you can provide. All the ones I keep finding on the web are for textboxes and I can use them just fine all day.

  • 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-13T17:06:28+00:00Added an answer on May 13, 2026 at 5:06 pm

    You’re close! What you want to do though is ComboBox.ItemTemplate, not SelectedValue. Prepare for some XAML hell.

    <ComboBox.ItemTemplate>
        <DataTemplate>
            <TextBlock>
                <TextBlock.Text>
                    <MultiBinding Converter="{StaticResource StringsToFillNameMultiConverter}">
                        <Binding Path="EmpFirstName" />
                        <Binding Path="EmpLastName" />
                    </MultiBinding>
                </TextBlock.Text>
            </TextBlock>
        </DataTemplate>
    </ComboBox.ItemTemplate>
    

    Also, if I recall correctly, you don’t need to create your own converter if you’re just formatting strings. I think you can do the following (someone please correct me if I’m wrong.)

    <!-- "Last, First" -->
    <MultiBinding StringFormat="{}{1}, {0}">
        <Binding Path="EmpFirstName" />
        <Binding Path="EmpLastName" />
    </MultiBinding>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I don't know why this is driving me nuts but it is. I have
This is driving me nuts. Its a tough one to explain but I'll have
Okay, this sounds stupid but this is driving me nuts. I have been working
This is really driving me nuts, I have a datagridview bound to a bindingsource,
This is literally driving me nuts. I have 2 entities that use NSStrings as
This is not working and it is driving me nuts. I have in the
This one's got me stumped and it's driving me nuts. I have a SiteFinity
This is driving me nuts. I believe I asked this exact same question, but
This is driving me nuts. I've looked at all the relevant MSDN tutorials but
This is driving me nuts. I'm checking 3 conditions in my sql query. If

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.