title: How to get the reference of a TextBlock.Text property
body: <p>Well I am stuck with an issue where I want to get the text that the <code>TextBlock</code> has but it's not working. I am stuck with a <code>System.NullReferenceException</code></p>
  
  <p>I have built a calendar where the dates are placed in the <code>TextBlock</code> now I want to get this data and compare it to the current date then highlight the date.</p>
  
  <p>Here are the codes I have used:</p>
  
  <pre><code>public class DateColorConvertor : IValueConverter
  {
  
      public object ConvertBack(object value, Type targetType, object parameter,
              System.Globalization.CultureInfo culture)
      {
          return new object();
      }
      public object Convert(object sender, Type targetType, object parameter, string language)
      {
          string currentItem = null;
          currentItem = (sender as TextBlock).Text;
          if (currentItem.Equals(DateTime.Today.Date))
                  return new SolidColorBrush(Colors.Green);
              else
              {
                  return new SolidColorBrush(Colors.Red);
              }
          //throw new NotImplementedException();
      }
  
      public object ConvertBack(object value, Type targetType, object parameter, string language)
      {
          throw new NotImplementedException();
      }
  }
  </code></pre>
  
  <p>xaml:</p>
  
  <pre><code>&lt;Grid Margin="10,102,10,298"&gt;
      &lt;GridView ItemsSource="{Binding Calendar.DateCollection}"&gt;
          &lt;GridView.ItemTemplate&gt;
              &lt;DataTemplate&gt;
                  &lt;Grid x:Name="dateGrid"  Background="Black" Width="50" Height="30"&gt;
                      &lt;Grid.Resources&gt;
                          &lt;local:DateColorConvertor x:Key="DateColorConvertor"/&gt;
                      &lt;/Grid.Resources&gt;
                      &lt;TextBlock x:Name="txtDate" Text="{Binding}"  Foreground="{Binding Converter={StaticResource DateColorConvertor}}" VerticalAlignment="Center" HorizontalAlignment="Center" IsTapEnabled="True"/&gt;
                  &lt;/Grid&gt;
              &lt;/DataTemplate&gt;
          &lt;/GridView.ItemTemplate&gt;
      &lt;/GridView&gt;
  &lt;/Grid&gt;
  </code></pre>