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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T10:40:50+00:00 2026-06-03T10:40:50+00:00

I have a MultiBinding that is not working on TextBox.Text. I have the same

  • 0

I have a MultiBinding that is not working on TextBox.Text. I have the same code that is binding properly to Value of Extended WPF Toolkit‘s IntegerUpDown.

It is going through an IMultiValueConverter that takes the bound POCO and the listbox it is part of (it is displaying the order of the item in the listbox)

Here is the code:

<!--works-->
<wpf:IntegerUpDown ValueChanged="orderChanged" x:Name="tripOrder">
    <wpf:IntegerUpDown.Value>
        <MultiBinding Converter="{StaticResource listBoxIndexConverter}" Mode="OneWay">
            <Binding />
            <Binding ElementName="listTrips" />
        </MultiBinding>
    </wpf:IntegerUpDown.Value>
</wpf:IntegerUpDown>
<!--doesn't work-->
<TextBox x:Name="tripOrder2">
    <TextBox.Text>
        <MultiBinding Converter="{StaticResource listBoxIndexConverter}" Mode="OneWay">
            <Binding />
            <Binding ElementName="listTrips" />
        </MultiBinding>
    </TextBox.Text>
</TextBox>

Here is the result:

result

I don’t believe it is relevant, but just in case, here is the class that performs the conversion:

    public class ListBoxIndexConverter : IMultiValueConverter
    {

    #region IMultiValueConverter Members

    public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        var trip = values[0] as TripBase;

        if (trip == null)
        {
            return null;
        }

        var lb = values[1] as CheckListBox;
        if (lb == null)
        {
            return null;
        }

        //make it 1 based
        return lb.Items.IndexOf(trip) + 1;
    }

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

    #endregion
}
  • 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-06-03T10:40:51+00:00Added an answer on June 3, 2026 at 10:40 am

    The converter should return the type that the property expects. The reason is that in regular use of the properties (i.e. without Binding), the properties may have type converters that convert from one type (or more) to the type required by the property. For example, when you write:

    <ColumnDefinition Width="Auto"/>
    

    there’s a converter that converts string “Auto” to:

    new GridLength(1, GridUnitType.Auto)
    

    When using binding, this mechanism is bypassed since the converter should return the right type.

    So, to fix your issue, at the return of your converter:

    return (lb.Items.IndexOf(trip) + 1).ToString();
    

    This should fix the TextBox.

    Now, for the IntegerUpDown. It sounds like it actually expects to receive an int and returning a string will break it. So, again, change the return of the converter:

    if (targetType == typeof(int))
    {
        return lb.Items.IndexOf(trip) + 1;
    }
    else if (targetType == typeof(string))
    {
        return (lb.Items.IndexOf(trip) + 1).ToString();
    }
    else
    {
        throw new NotImplementedException(String.Format("Can not convert to type {0}", targetType.ToString()));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following working XAML code that basically binds a couple of properties
So am testing multibinding in wpf and i have three text boxes which should
I have a rather complicated Binding situation. I have a solution that I created
I have a problem with the MultiBinding. It seems the latest value of the
I have this Markup: <GroupBox BorderThickness=2> <GroupBox.BorderBrush> <SolidColorBrush x:Name=Border> <SolidColorBrush.Color> <MultiBinding Converter={StaticResource ConnectionAndLoggedInToBorderBrush}> <Binding
I have a login form that contains a username textbox and a password box.
I have a text box whose Text property has a TwoWay MultiBinding with UpdateSourceTrigger
I have a list of of databound items. I have a textbox that filters
it seems that I have a problem with my multibinding. Scenario: I have a
I have a custom control which needs to configure a MultiBinding in code, which

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.