Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can make some items bold in listbox on UWP C#?

What I have tried:

Google shows a lot of links how to make some items in listbox(listview) bold.
But there no result with UWP. WPF APIs do not work in UWP.
Posted
Updated 14-Feb-18 0:52am

1 solution

WPF APIs don't work in UWP

public Form1()
    {
        InitializeComponent();

        ListBox1.Items.AddRange(new Object[] { "First Item", "Second Item"});
        ListBox1.DrawMode = DrawMode.OwnerDrawFixed;
    }

    private void ListBox1_DrawItem(object sender, DrawItemEventArgs e)
    {
        e.DrawBackground();
        e.Graphics.DrawString(ListBox1.Items[e.Index].ToString(), new Font("Arial", 10, FontStyle.Bold), Brushes.Black, e.Bounds);
        e.DrawFocusRectangle();
    }
 
Share this answer
 
Comments
Richard Deeming 15-Feb-18 13:52pm    
Is this supposed to be the solution to your question?

Why are you trying to call Windows Forms methods if you're trying to illustrate that WPF methods don't work?

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