ReadOnly をTrueに設定すると、データ ソースが読み取り専用になり、このデータ ソースにバインドされたコントロールは一切の変更を実行できなくなります。また、AllowAdd および AllowDelete の設定にかかわらず、セル内容の変更も行の追加と削除も行えません。このプロパティを True に設定すると、UltraDataSource の IBindingList.ReadOnly 実装は True を返します。
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinDataSource Imports Infragistics.Win.UltraWinGrid Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.Click ' Following code disables adding rows in all bands except first ' child band. UltraDataBand object has AllowAdd property whose ' default value is Default, in which case AllowAdd property off ' the UltraDataSource is used. However if AllowAdd off an ' UltraDataBand is explicitly set, it overrides the setting off ' the UltraDataSource. The same applies to AllowDelete and ReadOnly ' properties. ' Me.UltraDataSource1.AllowAdd = False Me.UltraDataSource1.Band.ChildBands(0).AllowAdd = DefaultableBoolean.True Me.UltraDataSource1.AllowDelete = False Me.UltraDataSource1.Band.ChildBands(0).AllowDelete = DefaultableBoolean.True ' NOTE: Setting ReadOnly to true disables adding and deleting rows ' regardless of the AllowAdd and AllowDelete property settings. Me.UltraDataSource1.ReadOnly = False Me.UltraDataSource1.Band.ChildBands(0).ReadOnly = DefaultableBoolean.False End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinDataSource; using Infragistics.Win.UltraWinGrid; using System.Diagnostics; private void button1_Click(object sender, System.EventArgs e) { // Following code disables adding rows in all bands except first // child band. UltraDataBand object has AllowAdd property whose // default value is Default, in which case AllowAdd property off // the UltraDataSource is used. However if AllowAdd off an // UltraDataBand is explicitly set, it overrides the setting off // the UltraDataSource. The same applies to AllowDelete and ReadOnly // properties. // this.ultraDataSource1.AllowAdd = false; this.ultraDataSource1.Band.ChildBands[0].AllowAdd = DefaultableBoolean.True; this.ultraDataSource1.AllowDelete = false; this.ultraDataSource1.Band.ChildBands[0].AllowDelete = DefaultableBoolean.True; // NOTE: Setting ReadOnly to true disables adding and deleting rows // regardless of the AllowAdd and AllowDelete property settings. this.ultraDataSource1.ReadOnly = false; this.ultraDataSource1.Band.ChildBands[0].ReadOnly = DefaultableBoolean.False; }