title: Xamarin Forms: How to set the width of two columns in a grid dynamically using mvvm
body: <p>I need to make a calculation in my view model to show a percentage range between two columns in a grid.</p>
  
  <p>I'm trying to set a string property to set the values in the view model as below,</p>
  
  <pre><code>// These two below values/ratio would be calculated dynamically,
  
  public string firstColValue = "3*";
  public string secondColValue = "7*";
  
  &lt;Frame CornerRadius="8" Grid.Row="0" HorizontalOptions="FillAndExpand" HeightRequest="8"&gt;
  &lt;Grid HorizontalOptions="FillAndExpand"&gt;
          &lt;Grid.ColumnDefinitions&gt;
              &lt;ColumnDefinition Width="{Binding firstColValue}"&gt;
              &lt;/ColumnDefinition&gt;
              &lt;ColumnDefinition Width="{Binding secondColValue}"&gt;
              &lt;/ColumnDefinition&gt;
          &lt;/Grid.ColumnDefinitions&gt;
          &lt;Grid.RowDefinitions&gt;
              &lt;RowDefinition Height="8"&gt;
              &lt;/RowDefinition&gt;
          &lt;/Grid.RowDefinitions&gt;
  
              &lt;Label Grid.Row="0" Grid.Column="0" HeightRequest="8" HorizontalOptions="FillAndExpand" BackgroundColor="Lime"&gt;&lt;/Label&gt;
              &lt;Label Grid.Row="0" Grid.Column="1" HeightRequest="8" HorizontalOptions="FillAndExpand" BackgroundColor="Blue"&gt;&lt;/Label&gt;
  
      &lt;/Grid&gt;
  &lt;/Frame&gt;
  </code></pre>
  
  <p>This is throwing me a run time exception. I'm trying to set the width of the two columns dynamically from the view model property.</p>
  
  <p>Please let me know how to achieve this.</p>