Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Need Output as "Hi Welcome MYNAME"

MYNAME as bold.

I am binding this text to the TextBlock through a property.[Text="{Binding MyProperty}" ]

My question is, How can i make a specific part of a Text coming form the property to be bold while displaying!
Posted

Checkout following xaml hope this will provide some guidlines to u

HTML
<grid x:name="LayoutRoot" background="White" xmlns:x="#unknown">
       <textblock fontfamily="Arial" width="400">
   <linebreak />
   <run foreground="Maroon" fontfamily="Courier New" fontsize="24">
       Sample
   </run>
   <linebreak />
   <run foreground="Teal" fontfamily="Times New Roman" fontsize="18" fontstyle="Italic">
       Text
   </run>
   <linebreak />
   <run foreground="SteelBlue" fontfamily="Verdana" fontsize="14" fontweight="Bold">
      Run
   </run>
       </textblock>
   </grid>
 
Share this answer
 
Comments
prabu_sn 3-May-12 7:28am    
Thanks for your reply.

I am binding that TextBlock through a single property called 'MyProperty', in that i need some section as bold.

I tried with multibinding also.
pls check the code:

prabu_sn 3-May-12 7:36am    
please see code below given as Answer
Hi please go thorough it once

make some part of text as bold[^]
 
Share this answer
 
XML
<TextBlock  >
        <TextBlock.Text>
            <MultiBinding  StringFormat="{}{0}{1}" " >

                <Binding Path="Text" ElementName="txtTest" />
                <Binding Path="Text" ElementName="txtTest1" />
            </MultiBinding>
        </TextBlock.Text>
            <TextBox x:Name="txtTest" FontWeight="Bold" Text="{Binding MyPropert1}"></TextBox>
            <TextBox x:Name="txtTest1" Text="{Binding MyPropert2}"></TextBox>
        </TextBlock>
 
Share this answer
 
as my knowledge this is not possible
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900