■ UltraGrid 클래스에서 데이터 네비게이터 사용하는 방법을 보여준다.
▶ 예제 코드 (C#)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
using System; using System.Windows.Forms; using Infragistics.Win.UltraWinGrid; private UltraGrid ultraGrid; private TextBox companyNameTextBox; private TextBox contactNameTextBox; private TextBox contactTitleTextBox; private TextBox addressTextBox; private TextBox cityTextBox; private TextBox regionTextBox; private TextBox postalCodeTextBox; private TextBox countryTextBox; ... #region 폼 로드시 처리하기 - Form_Load(sender, e) /// <summary> /// 폼 로드시 처리하기 /// </summary> /// <param name="sender">이벤트 발생자</param> /// <param name="e">이벤트 인자</param> private void Form_Load(object sender, EventArgs e) { this.companyNameTextBox.DataBindings.Add ("Text", this.ultraGrid.DataSource, "CompanyName" ); this.contactNameTextBox.DataBindings.Add ("Text", this.ultraGrid.DataSource, "ContactName" ); this.contactTitleTextBox.DataBindings.Add("Text", this.ultraGrid.DataSource, "ContactTitle"); this.addressTextBox.DataBindings.Add ("Text", this.ultraGrid.DataSource, "Address" ); this.cityTextBox.DataBindings.Add ("Text", this.ultraGrid.DataSource, "City" ); this.regionTextBox.DataBindings.Add ("Text", this.ultraGrid.DataSource, "Region" ); this.postalCodeTextBox.DataBindings.Add ("Text", this.ultraGrid.DataSource, "PostalCode" ); this.countryTextBox.DataBindings.Add ("Text", this.ultraGrid.DataSource, "Country" ); } #endregion #region UltraGrid 레이아웃 초기화 하기 - ultraGrid_InitializeLayout(sender, e) /// <summary> /// UltraGrid 레이아웃 초기화 하기 /// </summary> /// <param name="sender">이벤트 발생자</param> /// <param name="e">이벤트 인자</param> private void ultraGrid_InitializeLayout(object sender, InitializeLayoutEventArgs e) { foreach(UltraGridColumn ultraGridColumn in e.Layout.Bands[0].Columns) { switch(ultraGridColumn.Key) { case "CustomerID" : ultraGridColumn.CellActivation = Activation.NoEdit; break; default : ultraGridColumn.Hidden = true; break; } } e.Layout.AutoFitStyle = AutoFitStyle.ResizeAllColumns; e.Layout.Override.SelectTypeCell = SelectType.None; e.Layout.Override.SelectTypeCol = SelectType.None; e.Layout.Override.SelectTypeRow = SelectType.None; } #endregion |