Andreas
Andreas

Reputation: 5631

Infragistics UltraGrid (9.2) count Band after DataSource is set

In an inherited UltraGrid I would like know how many Bands the grid contains after I set a new value on base.DataSource. How do I find that count?

Thanks

-a-

/*****Added screendump*****/

(code is not my property so I've scrambled away some possible trade secrets)

enter image description here

Upvotes: 0

Views: 2375

Answers (2)

Dmitriy Konovalov
Dmitriy Konovalov

Reputation: 1817

Try to use PropertyChanged event of the base class UltraControlBase:

public void Form1()
{
    InitializeComponents();
    ultraWinGrid.PropertyChanged += new Infragistics.Win.PropertyChangedEventHandler(ultraWinGrid_PropertyChanged);
}
void ultraWinGrid_PropertyChanged(object sender, Infragistics.Win.PropertyChangedEventArgs e)
{
    Infragistics.Shared.PropChangeInfo pinfo = e.ChangeInfo;
    try
    {
        // moving through the trigger stack
        while (pinfo!=null)
        {
            if (Equals(pinfo.PropId, Infragistics.Win.UltraWinGrid.PropertyIds.DataSource))
            {
                int newBandCount = this.ultraWinGrid.DisplayLayout.Bands.Count;
                /// your code here
            }
            pinfo=pinfo.Trigger;
        }
    }
    catch
    { 

    }
}

Upvotes: 0

Danko Valkov
Danko Valkov

Reputation: 1042

After setting the new dataSource object to the DataSource property of the UltraGrid you could verify the count like:

ultraGrid1.DisplayLayout.Bands.Count

Hope this is what you are looking for.

Upvotes: 1

Related Questions