title: How do I get different colors for parts of string object property binded to label in ItemControl?
body: <p>This is my object type:</p>
  <pre><code>public class selectedLevel
  {
     public string Level
      {
          get;
          set;
      }
  
     public string PlanetSelected
      {
          get; set;
  
      }
     public string houseDetails
      {
          get;
          set;
      }
  
      
  }
  </code></pre>
  <p>This is my itemTemplate:</p>
  <pre><code>
  &lt;ItemsControl x:Name=&quot;LevelDetails&quot; Margin=&quot;-464,416,120,-484&quot;   BorderBrush =&quot;Black&quot;  ItemsSource=&quot;{Binding selectedLevels}&quot; Grid.ColumnSpan=&quot;3&quot; HorizontalContentAlignment=&quot;Stretch&quot;&gt;
     &lt;ItemsControl.ItemsPanel&gt;
        &lt;ItemsPanelTemplate&gt;
           &lt;StackPanel Orientation=&quot;Horizontal&quot;/&gt;
        &lt;/ItemsPanelTemplate&gt;
     &lt;/ItemsControl.ItemsPanel&gt;
     &lt;ItemsControl.ItemTemplate&gt;
        &lt;DataTemplate&gt;
           &lt;Grid&gt;
              &lt;Grid.ColumnDefinitions&gt;
                 &lt;ColumnDefinition SharedSizeGroup=&quot;Col1&quot; /&gt;
                 &lt;ColumnDefinition SharedSizeGroup=&quot;Col2&quot; /&gt;
                 &lt;ColumnDefinition SharedSizeGroup=&quot;Col3&quot; /&gt;
                 &lt;ColumnDefinition SharedSizeGroup=&quot;Col4&quot; /&gt;
                 &lt;ColumnDefinition SharedSizeGroup=&quot;Col5&quot; /&gt;
                 &lt;ColumnDefinition SharedSizeGroup=&quot;Col6&quot; /&gt;
                 &lt;ColumnDefinition SharedSizeGroup=&quot;Col7&quot; /&gt;
                 &lt;ColumnDefinition SharedSizeGroup=&quot;Col8&quot; /&gt;
                 &lt;ColumnDefinition SharedSizeGroup=&quot;Col9&quot; /&gt;
                 &lt;ColumnDefinition SharedSizeGroup=&quot;Col10&quot;/&gt;
              &lt;/Grid.ColumnDefinitions&gt;
              &lt;Grid.RowDefinitions&gt;
                 &lt;RowDefinition SharedSizeGroup=&quot;Row1&quot;/&gt;
                 &lt;RowDefinition SharedSizeGroup=&quot;Row2&quot;/&gt;
                 &lt;RowDefinition SharedSizeGroup=&quot;Row3&quot;/&gt;
              &lt;/Grid.RowDefinitions&gt;
              &lt;Label x:Name=&quot;LevelName&quot; Grid.Row=&quot;0&quot;  Content=&quot;{Binding Level}&quot; HorizontalContentAlignment=&quot;Center&quot; FontWeight=&quot;Bold&quot; FontSize=&quot;16&quot; BorderBrush=&quot;Black&quot; BorderThickness=&quot;1&quot; Background=&quot;{x:Null}&quot;/&gt;
              &lt;Label x:Name=&quot;PlanetName&quot; Grid.Row=&quot;1&quot; Content=&quot;{Binding PlanetSelected}&quot; FontSize=&quot;14&quot; Foreground=&quot;Red&quot; BorderBrush=&quot;Black&quot; FontWeight=&quot;Bold&quot; HorizontalContentAlignment=&quot;Center&quot; BorderThickness=&quot;1&quot; /&gt;
              &lt;Label x:Name=&quot;LevelDetails&quot; Grid.Row=&quot;2&quot; HorizontalContentAlignment=&quot;Center&quot; Content=&quot;{Binding houseDetails}&quot; FontSize=&quot;14&quot; BorderBrush=&quot;Black&quot; FontWeight=&quot;Bold&quot; BorderThickness=&quot;1&quot; /&gt;
           &lt;/Grid&gt;
        &lt;/DataTemplate&gt;
     &lt;/ItemsControl.ItemTemplate&gt;
  &lt;/ItemsControl&gt;
  
  </code></pre>
  <p>The User control is bound with an object with an observable collection of type selectedLevel(shown at the top).</p>
  <p>I am adding the properties of SelectedLevels in a view model as follows:</p>
  <pre><code>selectedLevels.Add(new selectedLevel
  {
      Level = &quot;Mahadasha&quot;,
      PlanetSelected = Mahadashas[0].rulerName,
      houseDetails =  indicesList[0]  +  &quot;, &quot; + indicesList[1] + &quot;, &quot; + indicesList[2]
                      
  });
         
  </code></pre>
  <p>I am trying to get different colors for <code>indicesList[0]</code>, <code>indicesList[1]</code> and <code>indicesList[2]</code> in 3rd label which is bound with <code>houseDetails</code> but I can only change full text color and not a part of it.</p>
  <p>I am totally lost here. Can I get some assistance on how to set different colors to parts of string?</p>