Reputation: 379
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.
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.
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?
Upvotes: 5
Views: 6618
Reputation: 1378
I got this error when stringformatting a DateTime, like this:
Text="{Binding MyDateTime, StringFormat='yyyy-MM-dd
HH:mm:ss'}"
where 

is a NewLine character.
The solution for me was to escape the NewLine character with an extra backslash like this:
Text="{Binding MyDateTime, StringFormat='yyyy-MM-dd\
HH:mm:ss'}"
Upvotes: 3
Reputation: 182
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"
Upvotes: 10
Reputation: 379
Simple solution...
I had to put single quotes around it beacause it contained commas.
The commas are interpreted as separators, but the compiler kept it together.
Upvotes: 3