'Declaration Public Property ButtonAppearance As Infragistics.Win.AppearanceBase
public Infragistics.Win.AppearanceBase ButtonAppearance {get; set;}
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinGrid Private Sub UltraGrid1_InitializeLayout(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles UltraGrid1.InitializeLayout ' Set SupportThemes to false. Otherwise UltraGrid will draw themed buttons ' discarding the ButtonAppearance settings. Me.UltraGrid1.SupportThemes = False ' Set the column's style to button. Me.UltraGrid1.DisplayLayout.Bands(0).Columns("CustomerID").Style = ColumnStyle.Button ' Always show buttons rather than just when the mouse is hovered over the ' cell which is the default. Me.UltraGrid1.DisplayLayout.Bands(0).Columns("CustomerID").ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always End Sub Private Sub UltraGrid1_InitializeRow(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeRowEventArgs) Handles UltraGrid1.InitializeRow Dim cell As UltraGridCell = e.Row.Cells("CustomerID") If cell.Text.StartsWith("A") Then cell.ButtonAppearance.BackColor = Color.Red Else cell.ButtonAppearance.ResetBackColor() End If End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; using System.Diagnostics; private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { // Set SupportThemes to false. Otherwise UltraGrid will draw themed buttons // discarding the ButtonAppearance settings. this.ultraGrid1.SupportThemes = false; // Set the column's style to button. this.ultraGrid1.DisplayLayout.Bands[0].Columns["CustomerID"].Style = ColumnStyle.Button; // Always show buttons rather than just when the mouse is hovered over the // cell which is the default. this.ultraGrid1.DisplayLayout.Bands[0].Columns["CustomerID"].ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always; } private void ultraGrid1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e) { UltraGridCell cell = e.Row.Cells["CustomerID"]; if ( cell.Text.StartsWith( "A" ) ) cell.ButtonAppearance.BackColor = Color.Red; else cell.ButtonAppearance.ResetBackColor( ); }
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2