Add Bold Property to TreeNode
- Dominant language
- C#
- Stars
- 4.9k
- Forks
- 1.1k
- Avg merge
- 20h 23m
- Merged PRs (30d)
- 103
Description
The 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.
```C#
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.
Contributor guide
Assessment
This issue has not been assessed yet.