Solved

Wpf Listview text formatting

Posted on 2012-03-12
1
680 Views
Last Modified: 2012-03-23
Hi!

Is it possible to format text in wpf listview  i.e i have one cell that contains name and title.

i would like to have the name in BOLD and little bigger font size than the Title in the same cell.  

like this with a linefeed

Firstname SecName   --BOLD and 2 sizes bigger
CEO of xxxxxxx   smaller and perhaps Italics
0
Comment
Question by:jamppi
1 Comment
 
LVL 96

Accepted Solution

by:
Bob Learned earned 250 total points
Comment Utility
I would say that you could use a TextBlock in the ListBox item template, with different Run elements that have different styles applied.

XAML example:

<TextBlock.Inlines>
            <Run FontWeight="Bold" FontSize="14" Text="This is WPF TextBlock Example. " />
            <Run FontStyle="Italic" Foreground="Red" Text="This is red text. " />
            <Run FontStyle="Italic" FontSize="18" Text="Here is some linear gradient text. ">
                <Run.Foreground>
                    <LinearGradientBrush>
                        <GradientStop Color="Green" Offset="0.0" />
                        <GradientStop Color="Purple" Offset="0.25" />
                        <GradientStop Color="Orange" Offset="0.5" />
                        <GradientStop Color="Blue" Offset="0.75" />
                    </LinearGradientBrush>
                </Run.Foreground>
            </Run>
            <Run FontStyle="Italic" Foreground="Green" Text="How about adding some green? " />
        </TextBlock.Inlines>

Open in new window

0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now