'宣言 Public Class AfterCardCompressedStateChangedEventArgs Inherits System.EventArgs
public class AfterCardCompressedStateChangedEventArgs : System.EventArgs
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinGrid Imports System.Diagnostics ' Add the following code to an Initialize method of your form ' Typically InitializeComponent or Form.Load ' Set the band to Card View mode Me.ultraGrid1.DisplayLayout.Bands(0).CardView = True ' Set the CardStyle to Compressed to compress all the cards showing only the caption Me.ultraGrid1.DisplayLayout.Bands(0).CardSettings.Style = CardStyle.Compressed ' Subscribe to the BeforeCardCompressedStateChanged and AfterCardCompressedStateChanged events Me.ultraGrid1.BeforeCardCompressedStateChanged += New Infragistics.Win.UltraWinGrid.BeforeCardCompressedStateChangedEventHandler(Me.ultraGrid1_BeforeCardCompressedStateChanged) Me.ultraGrid1.AfterCardCompressedStateChanged += New Infragistics.Win.UltraWinGrid.AfterCardCompressedStateChangedEventHandler(Me.ultraGrid1_AfterCardCompressedStateChanged) Private Sub ultraGrid1_BeforeCardCompressedStateChanged(sender As Object, e As Infragistics.Win.UltraWinGrid.BeforeCardCompressedStateChangedEventArgs) ' The BeforeCardCompressedStateChanged event fires before a Card Row is Expanded/Compressed ' when the band is in CardCompressedView. ' The Row property of the BeforeCardCompressedStateChangedEventArgs event argument provides ' a reference to the UltraGridRow undergoing a CardCompressedState change. Debug.WriteLine(("CardCaption: " + e.Row.CardCaption)) ' The NewCompressedState property specifies the new CardCompressedState of the row: Compressed or Expanded. If e.NewCompressedState = CardCompressedState.Expanded Then Debug.WriteLine("The row is expanding") Else If e.NewCompressedState = CardCompressedState.Compressed Then Debug.WriteLine("The row is compressing") End If End If ' BeforeCardCompressedStateChangedEventArgs provides a Cancel property to indicate whether the event ' should be canceled. e.Cancel = True End Sub 'ultraGrid1_BeforeCardCompressedStateChanged Private Sub ultraGrid1_AfterCardCompressedStateChanged(sender As Object, e As Infragistics.Win.UltraWinGrid.AfterCardCompressedStateChangedEventArgs) ' The AfterCardCompressedStateChanged event fires after a Card Row is Expanded/Compressed ' when the band is in CardCompressedView. ' The Row property of the AfterCardCompressedStateChangedEventArgs event argument provides ' a reference to the UltraGridRow undergoing a CardCompressedState change. Debug.WriteLine(("CardCaption: " + e.Row.CardCaption)) ' The NewCompressedState property specifies the new CardCompressedState of the row: ' Compressed or Expanded. If e.NewCompressedState = CardCompressedState.Expanded Then Debug.WriteLine("The row has expanded") Else If e.NewCompressedState = CardCompressedState.Compressed Then Debug.WriteLine("The row has compressed") End If End If End Sub 'ultraGrid1_AfterCardCompressedStateChanged
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; using System.Diagnostics; // Add the following code to an Initialize method of your form // Typically InitializeComponent or Form.Load // Set the band to Card View mode this.ultraGrid1.DisplayLayout.Bands[0].CardView = true; // Set the CardStyle to Compressed to compress all the cards showing only the caption this.ultraGrid1.DisplayLayout.Bands[0].CardSettings.Style = CardStyle.Compressed; // Subscribe to the BeforeCardCompressedStateChanged and AfterCardCompressedStateChanged events this.ultraGrid1.BeforeCardCompressedStateChanged += new Infragistics.Win.UltraWinGrid.BeforeCardCompressedStateChangedEventHandler(this.ultraGrid1_BeforeCardCompressedStateChanged); this.ultraGrid1.AfterCardCompressedStateChanged += new Infragistics.Win.UltraWinGrid.AfterCardCompressedStateChangedEventHandler(this.ultraGrid1_AfterCardCompressedStateChanged); private void ultraGrid1_BeforeCardCompressedStateChanged(object sender, Infragistics.Win.UltraWinGrid.BeforeCardCompressedStateChangedEventArgs e) { // The BeforeCardCompressedStateChanged event fires before a Card Row is Expanded/Compressed // when the band is in CardCompressedView. // The Row property of the BeforeCardCompressedStateChangedEventArgs event argument provides // a reference to the UltraGridRow undergoing a CardCompressedState change. Debug.WriteLine( "CardCaption: " + e.Row.CardCaption ); // The NewCompressedState property specifies the new CardCompressedState of the row: Compressed or Expanded. if ( e.NewCompressedState == CardCompressedState.Expanded ) Debug.WriteLine( "The row is expanding" ); else if ( e.NewCompressedState == CardCompressedState.Compressed ) Debug.WriteLine( "The row is compressing" ); // BeforeCardCompressedStateChangedEventArgs provides a Cancel property to indicate whether the event // should be canceled. e.Cancel = true; } private void ultraGrid1_AfterCardCompressedStateChanged(object sender, Infragistics.Win.UltraWinGrid.AfterCardCompressedStateChangedEventArgs e) { // The AfterCardCompressedStateChanged event fires after a Card Row is Expanded/Compressed // when the band is in CardCompressedView. // The Row property of the AfterCardCompressedStateChangedEventArgs event argument provides // a reference to the UltraGridRow undergoing a CardCompressedState change. Debug.WriteLine( "CardCaption: " + e.Row.CardCaption ); // The NewCompressedState property specifies the new CardCompressedState of the row: // Compressed or Expanded. if ( e.NewCompressedState == CardCompressedState.Expanded ) Debug.WriteLine( "The row has expanded" ); else if ( e.NewCompressedState == CardCompressedState.Compressed ) Debug.WriteLine( "The row has compressed" ); }