title: change foreground color of textblock inside stackpanel using c# in windows phone
body: <p>Here is my xaml</p>
  
  <pre><code> &lt;ListBox   Margin="3,60,1,10" BorderThickness="2" Grid.Row="1" Name="lstAnnouncement" Tap="lstAnnouncement_Tap" Width="476" d:LayoutOverrides="VerticalMargin"&gt;
          &lt;ListBox.ItemTemplate&gt;
  
              &lt;DataTemplate&gt;
  
                  &lt;StackPanel   Name="thispanel"  Grid.Row="1" Orientation="Horizontal" Height="120" Width="478" &gt;
  
                      &lt;StackPanel.Background&gt;
                          &lt;ImageBrush ImageSource="Images/Text-ALU.png" Stretch="Fill" /&gt;
                          &lt;!--&lt;SolidColorBrush  Color="{Binding Path=background}"/&gt;--&gt;
                      &lt;/StackPanel.Background&gt;
                      &lt;toolkit:ContextMenuService.ContextMenu&gt;
                          &lt;toolkit:ContextMenu&gt;
                              &lt;toolkit:MenuItem Header="Delete" Click="MenuItem_Click"/&gt;
                              &lt;!--&lt;toolkit:MenuItem Header="Remove " Click="MenuItem_Click"/&gt;--&gt;
                          &lt;/toolkit:ContextMenu&gt;
                      &lt;/toolkit:ContextMenuService.ContextMenu&gt;
                      &lt;Grid  HorizontalAlignment="Left" Width="30" Margin="0,0,0,2" Background="#FF0195D5" Height="118"&gt;
                          &lt;!--&lt;Grid.Background&gt;
                              &lt;ImageBrush ImageSource="Images/Text-ALU.png" Stretch="Fill" /&gt;
                          &lt;/Grid.Background&gt;--&gt;
                          &lt;TextBlock  x:Name="txtDate" TextWrapping="Wrap" Text="{Binding Path=announcementDate}" RenderTransformOrigin="0.5,0.5" Margin="-43.169,44.001,-43.831,0" UseLayoutRounding="False" d:LayoutRounding="Auto" TextAlignment="Center" Height="30" VerticalAlignment="Top" Width="117"&gt;
                              &lt;TextBlock.RenderTransform&gt;
                                  &lt;CompositeTransform Rotation="-90"/&gt;
                              &lt;/TextBlock.RenderTransform&gt;
                          &lt;/TextBlock&gt;
                      &lt;/Grid&gt;
                      &lt;Grid HorizontalAlignment="Left" Width="5" Height="120"/&gt;
                      &lt;StackPanel   Orientation="Vertical" VerticalAlignment="Top" Width="432" Height="114"&gt;
                          &lt;TextBlock x:Name="txtTitle" Height="27" TextWrapping="Wrap" Text="{Binding Path=announcementTitle}"   FontSize="18.667" HorizontalAlignment="Left" Width="432" FontWeight="Bold" /&gt;
                          &lt;StackPanel Orientation="Horizontal" Width="432" Height="27"&gt;
                              &lt;TextBlock x:Name="txtBy" FontWeight="Bold" Height="27" TextWrapping="Wrap" Text="{Binding Path=announcementBy}"  FontSize="18.667" Width="399"/&gt;
                              &lt;Image x:Name="imgArrow" Width="25" Source="Images/Go-In-Arrow.png" Height="25" Margin="5,0,0,0"/&gt;
                          &lt;/StackPanel&gt;
                          &lt;StackPanel Orientation="Horizontal" Width="433" Height="60"&gt;
                              &lt;TextBlock x:Name="txtDesc" FontWeight="Bold" Height="58" TextWrapping="Wrap" Text="{Binding Path=announcementShortDescription}" FontSize="18.667" Width="371"/&gt;
                              &lt;TextBlock x:Name="txtID" Height="56" Text="{Binding Path=announcementID}"  TextWrapping="Wrap" Foreground="Black" FontSize="18.667" Width="8" Visibility="Collapsed"/&gt;
                              &lt;Image x:Name="imgType" Width="35" Source="{Binding Path=announcementTypeImage}" Height="40" Margin="27,20,0,0" d:LayoutOverrides="Height"/&gt;
                          &lt;/StackPanel&gt;
                      &lt;/StackPanel&gt;
                  &lt;/StackPanel&gt;
  
              &lt;/DataTemplate&gt;
          &lt;/ListBox.ItemTemplate&gt;
      &lt;/ListBox&gt;
  </code></pre>
  
  <p>i want to change foreground color of textblocxk with x:name txtDesc in code behind using c# </p>
  
  <p>i am trying </p>
  
  <pre><code>txtDesc.Foreground = Brushes.White;
  </code></pre>
  
  <p>but it not recognizing it so how to achieve it? also is there any other way to change foreground  colour using binding</p>