The value of the second parameter of the markup extension I am using is a string containing some commas and I don't want those commas to be interpreted as parameter separators by the xaml interpreter / parser, but that the whole string as such including the commas is used as value.
Here is an example:
<SomeControl SomeProperty="{Wpf:MyExtension MyFirstParameter,
MySecondParameter, being a string, containing some commas.}" />
Google didn't help, I found some similar issues but none apply to this problem:
Markup extensions are a XAML technique for getting a value that is neither a primitive nor a specific XAML type. Generally, for attribute usage, markup extensions are identified by being covered by a start and end brace. For example: {x:Static local:AppConstants. DefaultName} .
The most common markup extensions used in WPF programming are those that support resource references ( StaticResource and DynamicResource ), and those that support data binding ( Binding ). StaticResource provides a value for a property by substituting the value of an already defined resource.
On the programmatic level, a XAML markup extension is a class that implements the IMarkupExtension or IMarkupExtension<T> interface. You can explore the source code of the standard markup extensions described below in the MarkupExtensions directory of the Xamarin. Forms GitHub repository.
You can use single quotes to encapsulate a string; so your mark-up should look something like:
<SomeControl SomeProperty="{Wpf:MyExtension MyFirstParameter,
'MySecondParameter, being a string, containing some commas.'}" />
I'm not sure whether you will also need the {}
escape sequence mark-up.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With