views:

21

answers:

1

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.

+2  A: 
  <Grid.Resources>
    <Style TargetType="TextBlock">
       <Setter Property="TextWrapping" Value="Wrap" />
    </Style>
  </Grid.Resources>
Ozan
Oh man, that was too easy. I forgot about styles within the control declaration. That's where I was failing. Thanks!
Judah Himango