Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XAML won't render left curly bracket in button content #3000

Closed
JeroenOortwijn opened this issue May 14, 2020 · 3 comments
Closed

XAML won't render left curly bracket in button content #3000

JeroenOortwijn opened this issue May 14, 2020 · 3 comments

Comments

@JeroenOortwijn
Copy link

  • .NET Core Version: 3.1.202
  • Windows version: 10.0.18363
  • Does the bug reproduce also in WPF for .NET Framework 4.8?: Yes
  • Is this bug related specifically to tooling in Visual Studio (e.g. XAML Designer, Code editing, etc...)? Yes, filed a bug report, but it was closed and redirected here.

Problem description:

XAML designer won’t show left curly bracket if it’s defined with its decimal reference.

Actual behavior:

image

Building gives the following build error:

Error
MC3074
The tag '' does not exist in XML namespace https://schemas.microsoft.com/winfx/2006/xaml/presentation'. Line 13 Position 17.

Expected behavior:

image

Minimal repro:

<Window x:Class="Accolade_xaml_test.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:Accolade_xaml_test"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <WrapPanel>
        <Button Content="&#120;" FontSize="40" Width="40"/>
        <Button Content="&#121;" FontSize="40" Width="40"/>
        <Button Content="&#122;" FontSize="40" Width="40"/>
        <Button Content="&#123;" FontSize="40" Width="40"/> <!-- This should show left curly bracket { -->
        <Button Content="&#124;" FontSize="40" Width="40"/>
        <Button Content="&#125;" FontSize="40" Width="40"/>
        <Button Content="&#126;" FontSize="40" Width="40"/>
    </WrapPanel>
</Window>
@JeroenOortwijn
Copy link
Author

On a similar note, it won't show low line when followed by line feed:

image

        <Button Content="&#95;" FontSize="40" Width="40"/>
        <Button Content="&#95;&#10;" FontSize="40" Width="40"/> <!-- This should show low line _ -->
        <Button Content="&#96;" FontSize="40" Width="40"/>
        <Button Content="&#96;&#10;" FontSize="40" Width="40"/>

@weltkante
Copy link

Not rendering left curly bracket is by design and documented in several places, for example here. Reason is that the curly bracket character has special meaning and is used for markup extensions. You have to use {} as escape sequence.

@fabiant3
Copy link
Member

fabiant3 commented Jun 8, 2020

Thanks @weltkante for the follow up.

@fabiant3 fabiant3 closed this as completed Jun 8, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Apr 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants