Add Bold Property to TreeNode
See original GitHub issueThe native Win32 TreeView control supports the item state flag TVIS_BOLD for making TreeNodes bold. This is not exposed in the Windows Forms TreeNode API.
I would suggest adding a new Property bool Bold { get; set; } to TreeNode, which when set to true, sets the item state flag on the TreeView item.
namespace System.Windows.Forms
{
public partial class TreeNode
{
public bool Bold { get; set; }
}
}
Describe alternatives you’ve considered
The canonical way to do this now by setting the NodeFont to something derived from the original is a bit cumbersome and also has the problem of potentially using the wrong font. The built-in default font may be different from the default font set in the OS.
Setting the state flag manually via P/invoking SendMessage(TVM_SETITEMW ...) works but is difficult to implement and also only works if the TreeNode already has a handle, i.e. it has been added to the TreeView already.
Will this feature affect UI controls? Yes
The new property TreeNode.Bold should be settable via the designer like other TreeNode properties.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (4 by maintainers)

Top Related StackOverflow Question
This is exactly one of the reasons why the TVIS_BOLD flag exists in the first place, to avoid the text clipping problem. See https://devblogs.microsoft.com/oldnewthing/20090406-00/?p=18623
A definition for
TVIS_BOLDwas added in #1742, so we have it in our codebase now.Boldname does not fit in to the Windows Forms naming convention both at the type level, and at the level of the Windows Forms SDK. Typically a user would think ofBoldas being a property of aFont, ~however an individual node does not controlFont, instead it is controlled at theTreeViewlevel~ and there isNodeFontproperty, however it may not work as expected (see below).In this case I propose we create a property called
bool IsBold { get; set; }to control whether a tree node is rendered in bold text or not. This way the property fits well with otherIsXxxproperties exposed by theTreeNodetype.[UPDATE] applied @weltkante corrections and added a link to more background on the boldness issues