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 |
---|---|
Default |
|
Available values:
Name | Description | Return Value |
---|---|---|
True | The value is true. |
|
False | The value is false. |
|
Default | The value is specified by a global option or a higher-level object. |
|
#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 Inplace
property to Default
and use the Windows
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:
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 }
};
}
}
}