title: How to Bind Static Class property to UI component in XAML / Xamarin
body: <p>In Xamarin application, I am not able to Bind the static property of the C# user defined static Class property (Colors.BackgroundColor) to XAML. I need to set the background of the color of grid by static value defined in static class.</p>
  <p>But I am getting the error</p>
  <blockquote>
  <p>Type <strong>UserInterfaceDefinitions</strong> not found in xmlns</p>
  </blockquote>
  <p>on this XAML</p>
  <pre><code>BackgroundColor = &quot;{Binding Source = {x:Static MyNamespace.Mobile:UserInterfaceDefinitions.Colors} }&quot;
  </code></pre>
  <p>Static Class code</p>
  <pre><code>namespace MyNamespace.Mobile
  {
      public static class UserInterfaceDefinitions
      {
          public static class Colors
          {
              public static string BackgroundColor = &quot;#DCECE&quot;;
          }
  
          
      }
  }
  </code></pre>
  <p>XAML Code</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
  &lt;ContentPage xmlns=&quot;http://xamarin.com/schemas/2014/forms&quot;
               xmlns:x=&quot;http://schemas.microsoft.com/winfx/2009/xaml&quot;
                xmlns:buttons=&quot;clr-namespace:MyNamespace.Mobile.UI.Buttons&quot; 
                xmlns:Status=&quot;clr-namespace:MyNamespace.Mobile.UI.StatusDetails&quot;     
               x:Class=&quot;MyNamespace.Mobile.UI.TestAndDemoSelection&quot;&gt;
      &lt;ContentPage.Content  Margin=&quot;0,0,0,0&quot; BackgroundColor=&quot;White&quot;&gt;
  
      
   &lt;Grid x:Name=&quot;ChildGrid&quot; Grid.Row=&quot;1&quot; Grid.Column=&quot;0&quot;  ColumnSpacing=&quot;10&quot; BackgroundColor=&quot;White&quot; &gt;
                  &lt;Grid.ColumnDefinitions&gt;
                      &lt;ColumnDefinition Width=&quot;*&quot;&gt;&lt;/ColumnDefinition&gt; 
                  &lt;/Grid.ColumnDefinitions&gt;
              
              &lt;!-- I am getting the error as Type UserInterfaceDefinitions not found in xmlns--&gt;
  
              &lt;BoxView Grid.Column=&quot;0&quot; BackgroundColor = &quot;{Binding Source = {x:Static MyNamespace.Mobile:UserInterfaceDefinitions.Colors} }&quot; /&gt; 
           
   &lt;/Grid&gt;     
   
      &lt;/ContentPage.Content&gt;
  &lt;/ContentPage&gt;
  </code></pre>
  <p>Code Behind .cs</p>
  <pre><code>using MyNamespace.Mobile.UI.Models;
  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  
  using Xamarin.Forms;
  using Xamarin.Forms.Xaml;
  
  namespace MyNamespace.Mobile.UI
  {
      [XamlCompilation(XamlCompilationOptions.Compile)]
      public partial class TestAndDemoSelection : ContentPage
      {
          public TestAndDemoSelection()
          {
              InitializeComponent();
          }
   
      }
  }
  </code></pre>
  <p>How to bind the static class property to XAML ?</p>