How does one use a converter with Multiple parameters in a Windows Phone 7 Application?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Converters always implement IValueConverter. That means a call to Convert or ConvertBack passes a single additional parameter. That parameter is extracted from the XAML.
As Hitesh Patel suggests there is nothing to stop you putting more than one value into the parameter, so long as you have a delimiter to separate them out later, but you cannot use a comma as that delimits the XAML!
e.g.
XAML
Converter
Note, I have not checked it to see if a Pipe “|” character is valid in XAML there (should be), but if not just choose another character that does not clash.
Later versions of .Net do not require a character array for the simplest version of
Split, so you can use this instead:Addendum:
A trick eBay used to use in urls, years ago, was to delimit data in the URL with QQ. A double-Q does not naturally occur in text data. If you ever get stuck for a text delimiter that will avoid encoding issues just use QQ… This will not work with split though (which requires single characters, but nice to know) 🙂