Infragistics UltraGrid(9.2)计数DataSource设置后的Band

时间:2011-11-28 09:22:52

标签: infragistics ultragrid

在继承的UltraGrid中,我想知道在base.DataSource上设置新值后网格包含多少个波段。我如何找到计数?

由于

-a -

/ *****添加了screendump ***** /

(代码不是我的财产,所以我已经破坏了一些可能的商业机密)

enter image description here

2 个答案:

答案 0 :(得分:1)

将新的dataSource对象设置为UltraGrid的DataSource属性后,您可以验证计数如下:

ultraGrid1.DisplayLayout.Bands.Count

希望这就是你要找的东西。

答案 1 :(得分:0)

尝试使用基类 UltraControlBase PropertyChanged 事件:

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
    { 

    }
}
相关问题