Gets the highlighting settings, such as the highlight interval, color, mode, fading effect parameters...
Namespace: Dapfor.Net.UiAssembly: Dapfor.Net (in Dapfor.Net.dll) Version: 2.10.3.24917 (2.10.3.24917)
Syntax
C# |
---|
public Grid..::..GridHighlighting Highlighting { get; } |
Visual Basic |
---|
Public ReadOnly Property Highlighting As Grid..::..GridHighlighting Get |
Visual C++ |
---|
public: property Grid..::..GridHighlighting^ Highlighting { Grid..::..GridHighlighting^ get (); } |
F# |
---|
member Highlighting : Grid..::..GridHighlighting with get |
Property Value
Type: Grid..::..GridHighlightingThe highlighting settings.
Remarks
While Cell highlighting, the Grid blends the highlighting color with the background color of the Cell. It takes into account the alpha-channel of the Color to prevent from the background color erasing. 255 value of the alpha channel means that the highlighting color is opaque, 0 - transparent.
If the fading effect is enabled, the alpha-value of the highlighting color will evaluate with time. During the highlighting Interval each RefreshInterval the Cell will be repainted with a new highlighting color.
Examples
Copy | |
---|---|
//Some data object public class Product : INotifyPropertyChanged { //Some fields private double price; private DateTime maturity; [DoubleFormat(Precision = 3, ShortForm = true, ShowZero = false)] public double Price { get { return price; } set { if (price != value) { price = value; //Notify about color changing if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs("Price")); } } } } public DateTime Maturity { get { return maturity; } } public event PropertyChangedEventHandler PropertyChanged; } //Using sample public void HoToHighlightCell(Grid grid) { //Initialize the grid grid.Headers.Add(new Header()); grid.Headers[0].Add(new Column("Price")); grid.Headers[0].Add(new Column("Maturity")); //Enable the highlighting grid.Highlighting.Enabled = true; //Set a highlighting color, which is blended with the color of the cell //The grid supports alpha-channel. This prevents from the background color erasing. //255 - opaque, 0 - transparent grid.Highlighting.Color = System.Drawing.Color.FromArgb(200, 210, 60, 84); //Enable the fading effect grid.Highlighting.Fading = true; //Set an interval of 2 seconds to highlight the cell grid.Highlighting.Interval = new TimeSpan(0, 0, 0, 2); //Set a refresh interval of 30 milliseconds to repaint the cell //With the fading effect the alpha-value of the highlighting color will evaluate with time. //Each 30 milliseconds the grid will repaint the cell with a new highlighting color. grid.Highlighting.RefreshInterval = new TimeSpan(0, 0, 0, 0, 30); //Add data object to the grid. The object will be implicitly wrapped by the DataObjectAccessor class Product product = new Product(); grid.Rows.Add(product); //The object will notify the grid through the INotifyPropertyChanged, and the grid will automatically //start the highlighting process for the affected cell. //If the call comes from the non-GUI thread, the grid will synchronize them without blocking the calling thread. product.Price = 12.34; //Another way to highlight the cell. The cell will be highlighted for 2 seconds with the red color and fading effect Cell cell = grid.Rows[0]["Price"]; cell.Highlight(new TimeSpan(0, 0, 0, 3), Color.Red); } |
Thread Safety
The returned class is not thread safe, but notifications from the data object are safe.