Skip to main content
All docs
V25.1
  • DevExpress v25.1 Update — Your Feedback Matters

    Our What's New in v25.1 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

    Take the survey Not interested

    RepositoryItemTrackBar.InplaceModeImmediatePostChanges Property

    Gets or sets whether the in-place editor posts its value to the bound data source immediately after the value changes.

    Namespace: DevExpress.XtraEditors.Repository

    Assembly: DevExpress.XtraEditors.v25.1.dll

    NuGet Package: DevExpress.Win.Navigation

    #Declaration

    [Browsable(true)]
    public override DefaultBoolean InplaceModeImmediatePostChanges { get; set; }

    #Property Value

    Type Description
    DefaultBoolean

    True to post the edit value to the bound data source immediately after the value changes; False to post the edit value after losing focus.

    Available values:

    Name Description Return Value
    True

    The value is true.

    0

    False

    The value is false.

    1

    Default

    The value is specified by a global option or a higher-level object.

    2

    #Remarks

    Enable the InplaceModeImmediatePostChanges option to ensure that dependent functionality reacts immediately to user input (for example, conditional formatting, data summaries, event handlers that rely on bound field values, etc.).

    If the InplaceModeImmediatePostChanges property is set to DefaultBoolean.True, the editor posts its value to the data source as soon as its value changes (without waiting for the cell to lose focus). This behavior is supported by in-place editors where input does not rely on text editing:

    • CheckEdit
    • ToggleSwitch
    • RadioGroup
    • TrackBarControl
    • RatingControl
    • PopupBaseEdit descendants

    If the InplaceModeImmediatePostChanges property is set to DefaultBoolean.False, the editor posts its value after losing focus (for example, when the user focuses another grid cell).

    Tip

    Set the InplaceModeImmediatePostChanges property to DefaultBoolean.Default and use the WindowsFormsSettings.InplaceEditorUpdateMode property to control update behavior globally:

    • Immediate - Post the edit value immediately after the user modifies it.
    • Postponed - Post the edit value when the cell loses focus.

    #Example

    The following example:

    • Binds the grid to a collection of Product objects.
    • Creates a RepositoryItemCheckEdit that immediately posts changes to the grid’s data source.
    • Creates an unbound column to display notes for out-of-stock products.
    • Creates a conditional formatting rule to highlight out of stock products.

    The following animation shows the result:

    Immediate Post Changes - WinForms Data Grid, DevExpress

    using DevExpress.XtraGrid;
    using DevExpress.XtraGrid.Columns;
    using DevExpress.XtraEditors;
    using DevExpress.XtraEditors.Repository;
    using DevExpress.XtraBars.Ribbon;
    using DevExpress.Utils;
    using System.Collections.Generic;
    using System.Drawing;
    using System.ComponentModel.DataAnnotations;
    
    namespace DXApplication {
        public partial class Form1 : RibbonForm {
            public Form1() {
                InitializeComponent();
    
                // Bind the grid to data.
                gridControl.DataSource = DataHelper.LoadProducts();
                // Force the grid to initialize its structure and data binding.
                gridControl.ForceInitialize();
    
                // Create a new check edit repository item with immediate value posting enabled.
                RepositoryItemCheckEdit riCheckEdit1 = new RepositoryItemCheckEdit(){
                    InplaceModeImmediatePostChanges = DefaultBoolean.True
                };
    
                // Add the repository item to the grid's collection.
                gridControl.RepositoryItems.Add(riCheckEdit1);
    
                // Assign the repository item to the "InStock" column.
                gridView.Columns["InStock"].ColumnEdit = riCheckEdit1;
    
    
                AppearanceObject valueRuleAppearance = new AppearanceObject() {
                    BackColor = Color.WhiteSmoke,
                    ForeColor = Color.Gray
                };
    
                // Create a formatting rule that targets "true" values in the "InStock" column.
                FormatConditionRuleValue valueRule = new FormatConditionRuleValue()
                {
                    Value1 = false, // Trigger formatting when the value is false.
                    Condition = FormatCondition.Equal, // Apply the rule when the value equals false.
                };
                // Assign appearance settings to the rule.
                valueRule.Appearance.Assign(valueRuleAppearance);
    
                // Create a format rule for the "InStock" column.
                GridFormatRule inStockRule = new GridFormatRule(){
                    Rule = valueRule,
                    Column = gridView.Columns["InStock"],
                    ApplyToRow = true,
                    Enabled = true
                }; 
    
                // Add the formatting rule to the grid.
                gridView.FormatRules.Add(inStockRule);
    
                // Enable the Conditional Formatting menu item in the grid's context menu.
                gridView.OptionsMenu.ShowConditionalFormattingItem = true;
    
                // Create an unbound column to display notes based on a condition.
                GridColumn notesColumn = new GridColumn() {
                    FieldName = "Notes",
                    Visible = true,
                    UnboundDataType = typeof(string),
                    UnboundExpression = "Iif([InStock], '', 'Not available in your region')",
                };
    
                gridView.Columns.Add(notesColumn);
            }
        }
    
        public class Product {
            public string Name { get; set; }
            [DisplayFormat(DataFormatString = "c2")]
            public double Price { get; set; }
            public bool InStock { get; set; }
        }
    
        public class DataHelper {
            public static List<Product> LoadProducts() {
                return new List<Product> {
                    new Product { Name = "Product 1", Price = 10.0, InStock = true },
                    new Product { Name = "Product 2", Price = 20.0, InStock = false },
                    new Product { Name = "Product 3", Price = 30.0, InStock = true },
                    new Product { Name = "Product 4", Price = 40.0, InStock = false },
                    new Product { Name = "Product 5", Price = 50.0, InStock = true }
                };
            }
        }
    }
    
    See Also