Solved

Wpf Listview text formatting

Posted on 2012-03-12
1
690 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

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…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

726 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