Reputation: 60021
I've got a Grid in my XAML page. The grid is simply a holder for XAML loaded from the database:
<Grid x:Name="dynamicXamlHolder" />
I want all <TextBlock>
objects that get inserted into that grid to have .TextWrapping = Wrap
.
How can I do this? I'm sensing styles might be the answer, but it's unclear to me how to create a grid style that affects <TextBlock>
elements in the grid.
Upvotes: 2
Views: 490
Reputation: 4415
<Grid.Resources>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
</Style>
</Grid.Resources>
Upvotes: 6