StringFormat shows error in Designer, but not after compiling
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.
Kalkulation.Artikel.PartWeight
Kalkulation.Artikel.SprueWeight
I've implemented this like in the screenshot below.
For each StringFormat
I get three errors:
StringFormat
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;
FrameworkCompatibilityPreferences.KeepTextBoxDisplaySynchronizedWithTextProperty = false;
What can i do to change this? Can i at least "filter" the error messages?
StringFormat
StringFormat='{}{0:#,##0.#}'
Yea, this was all i needed ... thanks
– Diego
Jul 3 at 9:37
2 Answers
2
I had the same issue and solved it by manually deleting obj/bin folder and rebuilding the solution.
Please see here for a similar issue in Xamarin.
Sorry mate, didn't work, but it's good to know for the future!
– Diego
Jul 3 at 9:38
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.
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Did you try wrapping your
StringFormat
value in single quotes? Somethink likeStringFormat='{}{0:#,##0.#}'
.– Il Vic
Jul 3 at 7:48