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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T06:35:02+00:00 2026-06-08T06:35:02+00:00

I am using Caliburn.Micro. In my View I have a TextBox Binded to double

  • 0

I am using Caliburn.Micro.

In my View I have a TextBox Binded to double X and a Button which alters the value of X in my ViewModel.

public void ButtonPressed()
    {
        X = AnObject.GetDouble;
        NotifyOfPropertyChange(() => X);
    }

    public double X { get; set; }

My Goal is to limit the number of decimals that is displayed. This number, is configurable in the application and therefore available as a Property of AnObject. Therefore I have defined a IMultiValueConverter:

public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
    {
        return String.Format(values[1].ToString(), values[0]);
    }

and defined my TextBox as follows:

<TextBox>
     <TextBox.Text>
           <MultiBinding Converter="{StaticResource coordinateConverter}" >
                 <Binding Path="X" />
                 <Binding Path="AnObject.FormatNumberOfDecimals" />
           </MultiBinding>
     </TextBox.Text>
</TextBox>

What works: The initial value of X, zero, is being formatted correctly.

What doesn’t work: When the button is pressed, the new value is not being displayed in the TextBox.

Suggestions that don’t use IMultiValueConverter are welcome as well.

  • 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-08T06:35:04+00:00Added an answer on June 8, 2026 at 6:35 am

    It turns out that my string FormatNumberOfDecimalsshould be of format {0:0.0000} instead of 0.00000.

    0.0000 works on ContentStringFormat of a Label and does not cause Exceptions in my Visual Studio Designer but apparently does not work on a TextBox when using String.Format().

    {0:0.0000} works on ContentStringFormat of a Label and on my TextBox using String.Format(). Unfortunately, my Visual Studio Design view is now throwing an exception and of no use for the View with my TextBox.

    System.FormatException
    Input string was not in a correct format.
    at System.Text.StringBuilder.AppendFormat(IFormatProvider provider, String format, Object[] args)
    at System.String.Format(IFormatProvider provider, String format, Object[] args)
    at System.String.Format(String format, Object arg0)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Caliburn.Micro I have this WPF View that in design time uses
I am using Caliburn Micro for Implementing MVVM in WPF. I have a static
I have a wpf application using Caliburn.Micro. I need to bind a ListBox to
I have a wpf application using caliburn.micro. It has a datagrid and a combobox.
I've been using the Caliburn.Micro framework lately. I have a ShellView and two screens,
I am using Caliburn Micro in my Project and i have many UserControls and
I have an .NET 4.0 application using Caliburn.Micro. I want to create a dynamic
I have using Silverlight and Caliburn Micro and am having a problem getting child
I'm using MVVM via Caliburn Micro on WP7. I have a popup that is
I have a WPF application using Caliburn.Micro. A DataGrid is bound to a collection

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.