Click here to Skip to main content
13,044,467 members (58,514 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I have an issue with aligning the content in the second column to the top of the cell and to the right of it. I wish for it to be aligned level with the top line of the message column when the message content is forced to be wrapped. I made an orange border and the cell seems to remain the height and width of the content, is there any way to force the name cell height to be that of the message cell?

 <ScrollViewer x:Name="svwViewer" Grid.Row="1">
            <ListView x:Name="grdContent" ScrollViewer.CanContentScroll="False" removed="#FF171717" BorderThickness="0,0,0,0">
                    <GridView AllowsColumnReorder="False" ColumnHeaderContainerStyle="{StaticResource NoHeaderStyle}">
                        <GridViewColumn DisplayMemberBinding="{Binding colTime}" />
                                    <Border HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderBrush="Orange" BorderThickness="1">
                                        <Grid HorizontalAlignment="Right" VerticalAlignment="Top">
                                            <TextBlock HorizontalAlignment="Right" VerticalAlignment="Top" Foreground="#FFEEEEEE" Text="{Binding colUser}"/>
                                    <TextBlock TextWrapping="Wrap" HorizontalAlignment="Stretch" VerticalAlignment="Top" Foreground="#FFEEEEEE" Text="{Binding colMessage}" />

Here's a preview of what it looks like at the moment. As you can see the "TestUser" is not level with the top of the wrapped message. Any ideas?
Posted 1-Feb-13 1:46am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

It looks like you are setting the vertical alignment to "Top" on your Textbox.

What you should be doing is setting that vertical alignment on your DataGrid Cells. If I am understanding your question correctly, you want that textbox shifted upward.

If you want to see this behavior in all datagrid cells. I would suggest making it a style.

Coruscus 1-Feb-13 9:45am
That works fine for a datagrid, given there's a type 'DataGridCell', however, there is not a cell type for GridView, and I can't seem to find anywhere I can apply a style to in hope of achieving that effect.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 1 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100