Solved

Wpf Listview text formatting

Posted on 2012-03-12
1
686 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
ID: 37710910
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

840 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