WPF TextBlock TextAlignment="Right" not ALIGNing when data is integer/numeric

I can't get my currency column to correctly align right. If I set TextAlignment="Right" on the first two columns it works, the only thing I can glean out of this is that it has something to do with the last column being numeric (currency). I've tried using DockPanel and StackPan

I've included the XAML.

Thanks in advance for your help
<Window x:Class="Arbitrage.MainWindow"
        Title="MainWindow" MinWidth="640" Width="650" Height="400" MinHeight="400" xmlns:my="clr-namespace:Arbitrage" Loaded="Window_Loaded" WindowStyle="SingleBorderWindow" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" >
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
            <GradientStop Color="White" Offset="0" />
            <GradientStop Color="#FF151580" Offset="0.872" />
        <DataTemplate x:Key="expenseTemplate">
                    <ColumnDefinition Width="80"></ColumnDefinition>
                    <ColumnDefinition Width="170"></ColumnDefinition>
                    <ColumnDefinition Width="*"></ColumnDefinition>
                <TextBlock TextAlignment="Left" Text="{Binding PostedDate, StringFormat={}{0:MM/dd/yyyy}}" Grid.Column="0" />
                <TextBlock TextAlignment="Left" Text="{Binding Description}" Grid.Column="1" />
                <TextBlock TextAlignment="Right" Text="{Binding PostAmount, StringFormat={}{0:C}}" Grid.Column="2" />                    

        <WrapPanel HorizontalAlignment="Stretch" Margin="0,0,0,0" Name="wrapPanel1" VerticalAlignment="Top" Orientation="Horizontal" >
            <Label Content="Programs" MinWidth="200" Margin="10,10,200,0" />
            <Label Content="Revenues" MinWidth="200" Margin="10,10,0,0" />
            <ComboBox Name="cboPrograms" MinWidth="200" Margin="10,0,200,0" DisplayMemberPath="Description" ItemsSource="{Binding}" SelectedValuePath="ProgramID" SelectionChanged="cboPrograms_SelectionChanged" />
            <ComboBox Name="cboRevenues" MinWidth="200" Margin="10,0,0,0" DisplayMemberPath="Description" ItemsSource="{Binding}" SelectedValuePath="RevenueID" />
            <Label Content="Expenses" MinWidth="550" Margin="10,10,50,0" />
            <ListBox Name="lstExpenses" SelectionMode="Extended" MinWidth="350" MinHeight="200" MaxHeight="200" Margin="10,0,0,0" ItemsSource="{Binding}" ItemTemplate="{StaticResource expenseTemplate}" />               

Open in new window

Who is Participating?
MikeTooleConnect With a Mentor Commented:
The problem lies in the '*' sizing of the last column.
WPF seems to use the text width as the column size on a row-by-row basis. The data is right-aligned, but in the space of its own width. (Add a background color to observe the effect.)
It can be fixed by specifying a Width in the DataTemplate for either the 3rd column, or the Grid, e.g:
            <Grid Width="350">
revstudioAuthor Commented:
Ya know that thought actually crossed my mind at some point yesterday and I dismissed it.

Tried specifying a width for the column this morning and it worked perfectly.

Sometimes we can't see the forest for the trees.

Thank you.
All Courses

From novice to tech pro — start learning today.