tags:

views:

41

answers:

0

The thing is that I have a GridViewColumn (In WPF) and I want to do my own implementation of text wrapping (which it doesn't have it itself, even though when you double click between columns they do wrap the text...). Anyway, all the columns have a template with a label in it, so I need to get all those rows, get the labels, measure which is the largest, and set the width of the column to that (in the code of course). This is what I have:

    <GridViewColumn Header="% Parent">
        <GridViewColumn.CellTemplate>
            <DataTemplate>
                <Label x:Name="labelParent" Padding="0" Content="{Binding ParentPct}" />
      </DataTemplate>
     </GridViewColumn.CellTemplate>
    </GridViewColumn>

So I need to get the labelParent label off from every row the grid generates, run the ColumnWrap method to get the largest label (with ActualWidth I suppose) and finally, set that width to the GridViewColumn.

Thanks in advance!

EDIT:

BTW I know the question has been asked HERE before, but it doesn't have closure.