0
votes

I need to use an ItemTemplate that will make the items look as similar as possible to the Messaging Hub on Windows Phone. Currently, I have this code as my DataTemplate, but I can't get the TextBlock to align to the right side of the horizontal StackPanel.

<StackPanel Orientation="Right">
    <StackPanel>
        <TextBlock Text="{Binding IP}"/>
        <TextBlock Text="{Binding LastMessage}"/>
    </StackPanel>
    <TextBlock HorizontalAlignment="Right" Text="{Binding Time}"/>
</StackPanel>

An image of the Messaging Hub on Windows Phone:

Windows Phone Messaging Hub

1
What Messaging Hub do you mean? The messages app? If you can provide an image or something of what you mean I think I can help out.Graham Smith

1 Answers

1
votes

you can use Grid for this, see example:

    <Grid>
       <Grid.ColumnDefinitions>
            <ColumnDefinition Width="0.7*"/>
            <ColumnDefinition Width="0.3*"/>
        </Grid.ColumnDefinitions>
        <StackPanel Grid.Column="0" HorizontalAlignment="Left">
            <TextBlock Text="{Binding IP}"/>
            <TextBlock Text="{Binding LastMessage}"/>
        </StackPanel>
        <TextBlock Grid.Column="1" HorizontalAlignment="Right" Text="{Binding Time}"/>
    </Grid>