Application: MVVM
Technology: Prism, Unity 2.2
How do you control each cell text alignment in each column? My ListView is bounded to a property in myEntrySummaryViewModel:
public IObservableEntry Entry { get; private set; }
My ListView in View.xaml is bounded like this:
<ListView BorderThickness="0" Width="Auto" ItemsSource="{Binding Path=Entry.Items}" SelectedItem="{Binding Path=CurrentEntrySummaryItem, Mode=TwoWay}" AlternationCount="2" IsSynchronizedWithCurrentItem="True" AutomationProperties.AutomationId="PositionSummaryGrid">
...and the .Items comes from public class ObservableEntry : IObservableEntry like this:
public ObservableCollection<EntrySummaryItem> Items { get; private set; }
...and my GridView nested in my ListView is like this:
<GridViewColumn Header="Compressed Size" DisplayMemberBinding="{Binding Path=CompressedSize}" Width="Auto" ></GridViewColumn>
... I tried this, but it doesn't work:
<GridViewColumn Header="Compressed Size" DisplayMemberBinding="{Binding Path=CompressedSize}" Width="Auto" ><GridViewColumn.CellTemplate><DataTemplate><TextBlock Width="Auto" TextAlignment="Center" Text="{Binding Path=CompressedSize}" /></DataTemplate></GridViewColumn.CellTemplate></GridViewColumn>
I want to be able to control each text alignment. Thanks!...
Code is like a box of chocolates!...