title: WPF Text Formatting in GridViewColumn
body: <p>I want to apply a format (align text, format for the currency 0000.00) to the columns in the GridViewColumn.</p>
  
  <pre><code> &lt;GridViewColumn TextBlock.TextAlignment="Center" Width="80" DisplayMemberBinding="{Binding XPath=Name}"/&gt;
  </code></pre>
  
  <p>The idea is the following one: In the columns (GridViewColumn) the text that our could apply a format to him (Aligners on the left, right, center, justify, etc.).</p>
  
  <p>In the following code they can see the different attempts without obtaining any result</p>
  
  <p>The code is as follows:</p>
  
  <pre><code> &lt;Window x:Class="ListViewTest.Test0.ListViewTest"
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     Title="Empty ListView Grid" Height="216" Width="435" FlowDirection="LeftToRight" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.IsSharedSizeScope="False"&gt;
      &lt;Window.Resources&gt;
          &lt;XmlDataProvider x:Key="CustomersDS" Source="C:\data.xml"/&gt;
          &lt;Style x:Key="myHeaderStyle" TargetType="{x:Type GridViewColumnHeader}"&gt;
              &lt;Setter Property="Visibility" Value="Collapsed" /&gt;
          &lt;/Style&gt;
      &lt;/Window.Resources&gt;
  
  
  
      &lt;ListView Margin="0,0,0,50" ItemTemplate="{DynamicResource CustomerTemplate}" ItemsSource="{Binding Source={StaticResource CustomersDS}, XPath=/Customers/Customer}"&gt;
          &lt;ListView.View&gt;
              &lt;!--ColumnHeaderContainerStyle="{StaticResource myHeaderStyle}"--&gt;
              &lt;GridView &gt;
                  &lt;GridViewColumn Width="80" TextBlock.TextAlignment="Center"&gt;
                      &lt;GridViewColumn.CellTemplate&gt;
                      &lt;DataTemplate&gt;
                          &lt;TextBlock HorizontalAlignment="Center" Text="{Binding XPath=Code}"&gt;&lt;/TextBlock&gt;
                      &lt;/DataTemplate&gt;
                    &lt;/GridViewColumn.CellTemplate&gt;
                  &lt;/GridViewColumn&gt;
                  &lt;GridViewColumn TextBlock.TextAlignment="Center" Width="80" DisplayMemberBinding="{Binding XPath=Name}"/&gt;
                  &lt;GridViewColumn Width="120" TextBlock.TextAlignment="center" DisplayMemberBinding="{Binding XPath=Country}"/&gt;
                  &lt;GridViewColumn Width="120" TextBlock.TextAlignment="center" DisplayMemberBinding="{Binding XPath=money}"/&gt;
              &lt;/GridView&gt;
          &lt;/ListView.View&gt;
      &lt;/ListView&gt;
  
  
  &lt;/Window&gt;
  </code></pre>
  
  <p>XML</p>
  
  <pre><code>     &lt;Customers&gt;
    &lt;Customer&gt;
   &lt;Code&gt;1234&lt;/Code&gt;
   &lt;Name&gt;EPI&lt;/Name&gt;
   &lt;Country&gt;Sesame Street&lt;/Country&gt;
  &lt;money&gt; 98.00&lt;/money&gt;
    &lt;/Customer&gt;
    &lt;Customer&gt;
   &lt;Code&gt;3234&lt;/Code&gt;
   &lt;Name&gt;Paul&lt;/Name&gt;
   &lt;Country&gt;United Kingdom&lt;/Country&gt;
  &lt;money&gt; 8.70&lt;/money&gt;
    &lt;/Customer&gt;
   &lt;Customer&gt;
   &lt;Code&gt;3344&lt;/Code&gt;
   &lt;Name&gt;Juan&lt;/Name&gt;
   &lt;Country&gt;Spain&lt;/Country&gt;
  &lt;money&gt; 785.5&lt;/money&gt;
    &lt;/Customer&gt;
   &lt;Customer&gt;
   &lt;Code&gt;4321&lt;/Code&gt;
   &lt;Name&gt;Dodo&lt;/Name&gt;
   &lt;Country&gt;Venezuela&lt;/Country&gt;
  &lt;money&gt; 150.02&lt;/money&gt;
    &lt;/Customer&gt;
  &lt;/Customers&gt;
  </code></pre>