Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Converters always implement <a href="http://msdn.microsoft.com/en-us/library/system.windows.data.ivalueconverter%28v=vs.95%29.aspx" rel="noreferrer">IValueConverter</a>. That means a call to <a href="http://msdn.microsoft.com/en-us/library/system.windows.data.ivalueconverter.convert%28v=vs.95%29.aspx" rel="noreferrer">Convert</a> or <a href="http://msdn.microsoft.com/en-us/library/system.windows.data.ivalueconverter.convertback%28v=vs.95%29" rel="noreferrer">ConvertBack</a> passes a single additional parameter. That parameter is extracted from the XAML.</p> <p>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, <strong>but you cannot use a comma as that delimits the XAML!</strong></p> <p>e.g. </p> <h2>XAML</h2> <pre><code>&lt;TextBlock Text="{Binding Path=ReleaseDate, Mode=OneWay, Converter={StaticResource MyConverter}, ConverterParameter=Param1|Param2}}" /&gt; </code></pre> <h2>Converter</h2> <pre><code>public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string parameterString = parameter as string; if (!string.IsNullOrEmpty(parameterString)) { string[] parameters = parameterString.Split(new char[]{'|'}); // Now do something with the parameters } } </code></pre> <p><em>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.</em></p> <p>Later versions of .Net do not require a character array for the simplest version of <code>Split</code>, so you can use this instead:</p> <pre><code>string[] parameters = parameterString.Split('|'); </code></pre> <h2>Addendum:</h2> <p>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) :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload