3

I have an infragistics UltraWinGrid and I want to disable the first column or make it "readonly". What is the way to do this?

I tried (none of these worked):

        _ultraGridRetailers.DisplayLayout.Bands[0].Columns[0].CellActivation = Activation.Disabled;
        _ultraGridRetailers.Rows[0].Cells[0].Activation = Activation.Disabled;
4

2 回答 2

4

对于任何具体问题,最好联系 Infragistics 的支持人员,但有关于您的问题:博客一

尝试调试您的应用程序,看看您是否过早地设置了此行为,或者您是否在指定的代码之后将其重置。根据博客文章,这应该是实现目标的方法,如果它不起作用,您最好联系支持并提交开发问题。

于 2012-01-06T11:48:30.087 回答
2

What I have tried is hooking to the InitializeLayout event of the UltraGrid like the following, and setting there the desired properties of the columns, which does work for me correctly:

private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
{
    //Make the column disabled or
    e.Layout.Bands[0].Columns[0].CellActivation = Activation.Disabled;
    //Make the column readonly
    e.Layout.Bands[0].Columns[0].CellActivation = Activation.ActivateOnly;
}

If the above doesn't work for you, most probably something overrides those settings in a later stage of your application.

于 2012-01-13T23:36:28.737 回答