Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

StringFormat shows error in Designer, but not after compiling

I have a C#/WPF Programm with MVVM.

Both Kalkulation.Artikel.PartWeight and Kalkulation.Artikel.SprueWeight are decimals.
The Format of both shall have one optional decimal place and a thousand seperator.

I've implemented this like in the screenshot below. Error in StringFormat

For each StringFormat I get three errors:

Error   XLS0112 Expected ''.    Kalkulation MainWindow.xaml 113 
Error   XLS0414 The type '' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. Kalkulation    MainWindow.xaml 113 
Error   XLS0112 Expected '

The picture shows the signs, that could not be displayed by Stackoverflow. enter image description here


When i compile, i have no Error at all, everything works as expected!
The Errormessages pop up again, when i change something i the XAML Code.

I have turned the Sync between Display an Textbox off to enter decimals with ease.
FrameworkCompatibilityPreferences.KeepTextBoxDisplaySynchronizedWithTextProperty = false;

What can i do to change this? Can i at least "filter" the error messages?

like image 302
Diego Avatar asked Dec 13 '22 15:12

Diego


1 Answers

If you already have single quotes and still get XLS0112 XAML errors, the delimiter {} in front of the formatting requests {0:C0} may be missing.

Be careful with any reformatting that removes all leading text which does not require the delimiter!

Good:

stringformat='Currency {0:C0}' // Proper string formatting

stringformat='{}{0:C0}' // Proper string formatting

Bad:

stringformat='{0:C0}' // Functions but raises "XLS0112 XAML"

like image 63
Rock Avatar answered Dec 16 '22 17:12

Rock