0

I have been trying (for a few days) to change the font weight in a wpf data grid cell of just one word.

Below is is the xaml which woks fine for changing the whole cell but how I would go about just one word i have no idea (not even sure where to start)

Maybe i need to use a richtextbox instead?

<DataGridTextColumn Width="450"  
                   Header="Message" 
                   Binding="{Binding Path=Element[Message].Value,Mode=TwoWay,UpdateSourceTrigger=LostFocus }" >
    <DataGridTextColumn.ElementStyle>
        <Style>
            <Setter Property="TextBlock.TextWrapping" Value="Wrap"  />

            <Setter Property="TextBlock.FontWeight" Value="Bold"   />
        </Style>
    </DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
crthompson
  • 15,653
  • 6
  • 58
  • 80
  • Which word? You are binding to a string. – Rohit Vats Dec 03 '13 at 19:50
  • You could break down the message in your viewmodel to select the word, then set it to a new property that is bound to a new textblock with bold set. Check out [this SO Question](http://stackoverflow.com/questions/5263055/wpf-making-part-of-the-text-bold) – crthompson Dec 03 '13 at 19:55
  • That works great but how would I apply it dynamically. for example if a data grid cell contained "hello i am bold" it would show up as "hello I am BOLD" The words to go in bold will be permanently set so I can hard wire them into XAML if need be? Thanks Fred – user3062970 Dec 04 '13 at 22:23

0 Answers0