Application Switches
Since 3.5.6
Some default behaviors in Wisej.NET are configurable with AppContext switches. These are the switches currently supported:
Label Self Size
LabelSelfSize (default: true)
The behavior of AutoSize in Label controls differs from other controls, especially in standard containers like Panel, Form, Page, or GroupBox. When a Label is right-anchored in these containers, AutoSize adjusts width while maintaining the left position. This ensures the Label expands/contracts rightward without moving its left edge.
When the Label is in a custom layout container (FlexLayoutPanel, FlowLayoutPanel, TableLayoutPanel), AutoSize behaves like other controls.
Corresponds to Label.SelfSizeDefault and Label.SelfSize.
DataGridView Auto Select
DataGridViewAutoSelectFirstRow (default: true)
By default, setting the current cell in a DataGridView selects the row, cell, or column based on SelectionMode. To prevent automatic selection when setting the current cell, set DataGridViewAutoSelectFirstRow to false.
Corresponds to DataGridView.AutoSelectFirstRowDefault and DataGridView.AutoSelectFirstRow.
DataGridView Auto Generate
DataGridViewAutoGenerateColumns (default: true)
The DataGridView automatically generates columns when DataSource is assigned in the designer, then sets AutoGenerateColumns to false after creating and serializing columns. Setting DataSource to null resets AutoGenerateColumns to true.
You cannot set AutoGenerateColumns in the designer as it's managed with the DataSource property. However, you can set its default initial value to false using the DataGridViewAutoGenerateColumns switch.
Corresponds to DataGridView.AutoGenerateColumnsDefault.
Form Auto Close
FormAutoCloseModalDialog (default: false)
In Wisej.NET, modal dialogs require calling Close() to close. Setting AutoCloseModalDialog to true enables automatic closure when Form.DialogResult is set to any value except DialogResult.None.
When AutoCloseModalDialog is true, the dialog closes automatically when:
User clicks
AcceptButtonorCancelButtonwithDialogResultsetCode sets the
DialogResultproperty
This matches WinForms behavior but differs from Wisej.NET's default.
Corresponds to Form.AutoCloseModalDialogDefault and Form.AutoCloseModalDialog.
Setting AppContext Switches
See Microsoft's System.AppContext documentation for various configuration approaches. Example code setup:
// Program static contstructor
public static class Program {
public void static Program() {
AppContext.SetSwitch("LabelSelfSize", false);
}
}'' Program static constructor
Module Program
Sub New()
AppContext.SetSwitch("LabelSelfSize", False)
End Sub
End ModuleLast updated
Was this helpful?

