Unexpected token Comma in Rule
This is an open and shut case which will hopefully save someone a headache in the future.
I had the following line in Notepad (via OneNote) that I was pasting into a TextBlock
to determ开发者_Go百科ine its visibility based on a property:
Visibility="{Binding IsPrinted, Converter={StaticResource VisibilityConverter}}"
However, this generated the following error:
Unexpected token Comma in Rule:
MarkupExtension ::= '{' TYPENAME @(Arguments)? '}',
in '{Binding IsPrinted, Converter={StaticResource VisibilityConverter}}'.
Everything appeared to be configured correctly and there was no discernible difference between this line and the line I'd copied it from in another UserControl, which worked fine.
The answer lies in the spaces.
Removing and re-adding the three spaces (between Binding
and IsPrinted
, between the comma and Converter
and between StaticResource
and VisibilityConverter
) resulted in a successful build.
It appears that Visual Studio spaces and standard spaces are different, and never the twain shall mix - copying the line out of Visual Studio into OneNote and editing it there caused the spaces to become mismatched.
The space characters are represented in Word as .
for a standard space and a little o
for a Visual Studio space. Using all of either in the line is fine, but mismatching them causes the error above.
精彩评论