LogoLogo
HomeNewsSupportVideos
  • Introduction
  • Getting Started
  • What's new in 4.0
    • Known Issues
    • .NET Core Designer
    • Managed Graphics
    • Fluent Markup
    • Markdown Support
    • Upgrade from 3.x
  • Releases
    • What's new in 4.0
    • What's new in 3.5
    • What's new in 3.2
      • View Builder
      • Validation Rules
      • Enhanced Font Support
      • Design-Time Debug
    • What's new in 3.1
    • What's new in 3.0
      • FAQs
      • Update Existing Projects
      • Multi Targeting
      • Visual Studio Designer
      • Referencing Assemblies
      • Docker Support
      • Troubleshooting
      • Deployment
    • What's new in 2.5
    • What's new in 2.2
    • What's new in 2.1
    • What's new in 2.0
    • Upgrade from 1.x
  • Getting Started
    • New Project
    • Templates
    • Troubleshooting
    • License Activation
    • FAQ
    • API
    • Hybrid
    • Deployment
    • Theme Builder
  • Concepts
    • Startup
    • Configuration
    • Load Balancing
    • Designer
    • Layouts
    • Client Profiles
    • Tab Order
    • Compression
    • Embedded Resources
    • Modal Workflow
    • Localization
    • RightToLeft
    • Background Tasks
    • Real Time Web Applications
    • JavaScript
    • JavaScript Object Model
    • Security
    • Synchronization
    • Session Management
    • Theming
    • Dependency Injection
    • Application Switches
    • Visual Studio Code
  • Controls & Components
    • General
      • Application
      • AutoSizing
      • AutoScroll
      • AutoScaling
      • Accessibility
      • Colors & Fonts
      • Embedded Tools
      • Events
      • Touch Events
      • Images
      • Labels
      • ToolTips
      • Data Binding
      • Common Properties
      • Custom Painting
      • Move & Resize
      • Drag & Drop
      • Validation
      • User Data
      • Responsive Properties
      • VB.NET Extensions
    • Common Dialogs
      • FolderBrowserDialog
      • ColorDialog
      • OpenFileDialog
      • SaveFileDialog
    • Editors
      • TextBox
        • TagTextBox
        • MaskedTextBox
        • TypedTextBox
      • DateTimePicker
      • MonthCalendar
      • TimeUpDown
      • DomainUpDown
      • NumericUpDown
      • TrackBar
    • Buttons
      • Button
      • SplitButton
      • CheckBox
      • RadioButton
    • Containers
      • Page
      • Form
      • Desktop
      • Panel
      • FlexLayoutPanel
      • FlowLayoutPanel
      • TableLayoutPanel
      • GroupBox
      • Accordion
      • TabControl
      • UserPopup
      • UserControl
      • ToolBar
      • StatusBar
      • SplitContainer
      • SlideBar
    • Lists & Grids
      • ComboBox
        • UserComboBox
        • TreeViewComboBox
        • ListViewComboBox
      • ListBox
        • CheckedListBox
      • TreeView
      • ListView
      • DataGridView
        • Column
        • TextBoxColumn
        • ButtonColumn
        • LinkColumn
        • ImageColumn
        • MaskedTextBoxColumn
        • DateTimePickerColumn
        • NumericUpDownColumn
        • CheckBoxColumn
        • ComboBoxColumn
      • DataRepeater
      • PropertyGrid
    • Extenders
      • Animation
      • ToolTip
      • ErrorProvider
      • Rotation
      • StyleSheet
      • JavaScript
    • Media
      • Audio
      • Video
      • FlashPlayer
    • Content
      • Label
      • LinkLabel
      • PictureBox
      • ScrollBars
      • Upload
      • AspNetPanel
      • ImageList
      • PdfViewer
      • ProgressBar
      • Spacer
      • Widget
      • WebBrowser
      • IFramePanel
      • HtmlPanel
      • Canvas
      • Shape
      • Line
    • Menus
      • MainMenu
      • MenuBar
      • MenuItem
      • LinkMenuItem
      • ContextMenu
    • Notifications
      • AlertBox
      • MessageBox
      • Toast
    • Other Components
      • Timer
      • BindingSource
      • BindingNavigator
      • DataSet
      • EventLog
      • MessageQueue
      • PerformanceCounter
Powered by GitBook
On this page
  • Label Self Size
  • DataGridView Auto Select
  • DataGridView Auto Generate
  • Form Auto Close
  • Setting AppContext Switches

Was this helpful?

Export as PDF
  1. Concepts

Application Switches

PreviousDependency InjectionNextVisual Studio Code

Last updated 3 months ago

Was this helpful?

Since 3.5.6

Some default behaviors in Wisej.NET are configurable with 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 AcceptButton or CancelButton with DialogResult set

  • Code sets the DialogResult property

This matches WinForms behavior but differs from Wisej.NET's default.

Corresponds to Form.AutoCloseModalDialogDefault and Form.AutoCloseModalDialog.

Setting AppContext Switches

// 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 Module

See Microsoft's documentation for various configuration approaches. Example code setup:

AppContext
System.AppContext