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

Image doesn't recognize SVG internal CSS #625

Closed
nxtn opened this issue Apr 27, 2019 · 3 comments
Closed

Image doesn't recognize SVG internal CSS #625

nxtn opened this issue Apr 27, 2019 · 3 comments
Assignees
Labels
team-Controls Issue for the Controls team

Comments

@nxtn
Copy link
Contributor

nxtn commented Apr 27, 2019

Steps to reproduce the bug

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 1000">
  <defs>
    <style>
      .cls-1 {
        fill: #666;
      }
    </style>
  </defs>
  <rect class="cls-1" x="0" y="0" width="1000" height="1000"/>
  <rect fill="#999" x="1000" y="0" width="1000" height="1000"/>
</svg>
<Image Source="svg.svg"/>

Expected behavior
The two rects are grey.

Actual behavior
The left rect is black.

Version Info

Windows 10 version Saw the problem?
October 2018 Update (17763) Yes
Device form factor Saw the problem?
Desktop Yes
@jevansaks
Copy link
Member

I would guess that the XAML svg parser just doesn't support this. @jesbis do you have info about this? Is it something that should work?

@msft-github-bot msft-github-bot added the needs-assignee-attention Assignee needs to follow-up or investigate this issue label Apr 29, 2019
@jesbis
Copy link
Member

jesbis commented Apr 29, 2019

The Xaml Image/SvgImageSource uses Direct2D, which supports the SVG 1.1 Secure Static mode features listed here:
https://docs.microsoft.com/windows/desktop/Direct2D/svg-support

Applying CSS-like styles via class attributes isn't currently supported.

@NextTurn: many design tools (e.g. Adobe Illustrator) let you change your SVG save/export options to apply the styles as inlined style attributes instead of external style defs. That will enable using styles in UWP apps and should make your content render correctly. Would that be an option?

I believe there may also be Visual Studio extensions created by the community to convert existing assets.

@nxtn
Copy link
Contributor Author

nxtn commented Apr 29, 2019

Thanks for the answer. Inline style attributes look good to me.

@nxtn nxtn closed this as completed Apr 29, 2019
@msft-github-bot msft-github-bot removed the needs-assignee-attention Assignee needs to follow-up or investigate this issue label Apr 29, 2019
@jevansaks jevansaks added the team-Controls Issue for the Controls team label Nov 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-Controls Issue for the Controls team
Projects
None yet
Development

No branches or pull requests

4 participants