Click here to Skip to main content
13,000,851 members (64,375 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hello All,
I am beginner to Windows phone Development .
I have defined string as below
string str = "[Basic settings:] bla bla bla"+
             "[Delete Settings:] bla bla bla"+
             "[Update Settings:] bla bla bla";
//this is a long string in same formate

<TextBlock Name="txtInfo" text="{Binding str}" Foreground="Yellow">

This works fine.All text in a textblock display "Yellow" colored text.
My Question :Is it possible to display a Text in "Red" which is surrounded by square brackets? and remaining in Yellow.
From above Example : [Basic settings:],[Delete Settings:],[Update Settings:] in Red
and all bla, bla ,bla are in Yellow ?

Thanks in advance!
Posted 26-Feb-13 9:12am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Not for the same string. Strings do not have colors. :-)

But with a Web application, a work around is way too simple. The nicest work around would be to break the line with some style tags, such as <span class="First">...</span>, <span class="second">...</span>, something like that.

Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Solved Myself!

Using Run and textBox.Inline.Add()

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170624.1 | Last Updated 28 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100