5

I know how to wrap text in dataGrid for one column .. how can I do it for all in project ... thanks ... so my code ...

<DataGrid Name="dataGrid1">
    <DataGrid.Columns>
        <DataGridTextColumn Width="*" Header="Person" Binding="{Binding Path=person}" >
            <DataGridTextColumn.ElementStyle>
                <Style>
                    <Setter Property="TextBlock.TextWrapping" Value="Wrap" />
                </Style>
            </DataGridTextColumn.ElementStyle>
        </DataGridTextColumn>
    </DataGrid.Columns>
</DataGrid>

1 Answers1

0

Paste the code in App.XAML. This style by default will applied to all grid.

<Application.Resources>
    <Style TargetType="DataGrid">
        <Setter Property="TextBlock.TextWrapping" Value="Wrap" />
    </Style>
</Application.Resources>
Sivasubramanian
  • 935
  • 7
  • 22