title: How to access const string from ViewModel in XAML x:Array
body: <p>I am using a converter for which I want to pass in 2 converter parameters. I have static strings in Converter, but I am not able to access it.</p>
  
  <p><strong>Problem Statement</strong>:</p>
  
  <p>Want to access <code>public static string STAR = "STAR";</code> in XAML x:Array.</p>
  
  <p>XAML:</p>
  
  <pre><code>&lt;UserControl.Resources&gt;
      &lt;local:CustomGridLengthConverter x:Key="CustomGridLengthConverter"/&gt;
  &lt;/UserControl.Resources&gt;
  
  &lt;Grid&gt;
      &lt;Grid.ColumnDefinitions&gt;
          &lt;ColumnDefinition Width="*"/&gt;
          &lt;ColumnDefinition Width="Auto"/&gt;
          &lt;ColumnDefinition&gt;
              &lt;ColumnDefinition.Width&gt;
                  &lt;Binding Path="CustomLength" Converter="{StaticResource CustomGridLengthConverter}"&gt;
                      &lt;Binding.ConverterParameter&gt;
                          &lt;x:Array Type="{x:Type system:String}"&gt;
                              &lt;system:String&gt;AUTO&lt;/system:String&gt;--&gt;Working
                              &lt;system:String&gt;STAR&lt;/system:String&gt;--&gt;Working
                              &lt;!--&lt;local:CustomGridLengthConverter.STAR/&gt;--&gt; *NOT* Working
                          &lt;/x:Array&gt;
                      &lt;/Binding.ConverterParameter&gt;
                  &lt;/Binding&gt;
              &lt;/ColumnDefinition.Width&gt;
          &lt;/ColumnDefinition&gt;
    &lt;/Grid.ColumnDefinitions&gt;
  </code></pre>
  
  <p>Converter Code:</p>
  
  <pre><code>public class CustomGridLengthConverter : IValueConverter
      {
          public static string ABSOLUTE = "ABSOLUTE";
          public static string AUTO= "AUTO";
          public static string STAR = "STAR";
  
          public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
          {
             double tempGridLengthVal = 0.0;
  
             //do necessary null/datatype check
             string[] params=parameter as string[];
  
             // use default value when 'value' is null
             string defaultValue=params[0];
  
             //use this value to specify if user wants absolute value or relative value.
             string convertTo=params[1];
  
             if (value.IsNotNull() &amp;&amp; Double.TryParse(value.ToString(), out 
             tempGridLengthVal))
             {
              //If given value is parsable, create new GridLength with this value
              gridLength = new GridLength(tempGridLengthVal);
  
              //User can specify if they want to use the given value as exact 
               value or as a star percentage
              if (convertTo.Equals(STAR))
                  gridLength = new GridLength(tempGridLengthVal,GridUnitType.Star);
              } 
          }
  </code></pre>
  
  <p><strong>EDIT</strong>: This is a different use case than "<a href="https://stackoverflow.com/questions/32395/accessing-static-fields-in-xaml">another question</a>" as in that question value is assigned to a dependency object, whereas I do not have a dependency object, I just want to pass in a static string value to an array.</p>
  
  <p>Thanks,</p>
  
  <p>RDV</p>