EMAW2008
EMAW2008

Reputation: 319

How to parse a URL in XAML that contains curly brackets and special characters?

The interface I am working on is supposed to display images from Adobe Scene7. The image is generated by a very long URL that is retrieve by an API. If the URL contains curly brackets, I am given an error that reads "Problem Parsing Modifier".

This is how the URL would normally be delivered from the API:

http://s7d7.scene7.com/is/image/GTMSportswear/?fmt=png-alpha&bgc=ffffff&hei=750&wid=750&fmt=png-alpha&GTM_Group=1&src={ugc-file:689232465.tif?fmt=tif-alpha}))))

Using fiddler, I can see that the image is actually being parsed like this:

http://s7d7.scene7.com/is/image/GTMSportswear/?fmt=png-alpha&bgc=ffffff&hei=750&wid=750&fmt=png-alpha&GTM_Group=1&src=))))

The part of the URL inside the curly brackets is left out and causes the "Problem Parsing Modifier" error, which I assume is being returned from Scene7.

When the URL is retrieved from an API, and is bound into the Source property of an image in my XAML:

    <Image Name="Image1" Source="{Binding URL1,Converter={StaticResource HtmlDecode}, Mode=OneWay}" Grid.Row="1" Grid.Column="0" />

I've attempted using a value converter that implements HtmlDecode, but to no avail. Attempting to replace the curly brackets with parenthesis also did not work. I have found very little support from Scene7 regarding how to overcome this. is there any other method for getting a url that contains the curly brackets to work within the XAML?

Upvotes: 0

Views: 259

Answers (1)

Jan Kupa
Jan Kupa

Reputation: 1

Use Value Converter which changes source string to whatever you want (for example escape your curly brackets).

Upvotes: 0

Related Questions