반응형

Devexpress PropertyGridControl 에 SelectedObject(s) 에 새로운 object를 할당해도 View가 Update되지 않는경우.

   


<해결방법>


1.  SelectedObject = null 값을 셋팅하고 다시 Object를 셋팅해 준다. 이렇게 해야 Event를 ChangeEvent를 받는것 같다.


2. Property Grid Row가 추가 되었음에도 화면이 갱신되지 않는 경우가 생긴다. 이럴경우에는 PropertyGridControl.UpdateRows()를 호출해준다.


이렇게 되면 추가된 Row Property들도 갱신이 되게 된다.

반응형

1. GridView에 Editing Mode로 진입 할때 클릭수와 관련된 옵션.

 - GridView.OptionsBehavior.EditorShowMode

 - columnEdit에 TextEditStyle을 DisableTextEditor로 함.

 

 

반응형

GridView에 CheckBox를 셋팅 및 관련 Event등록.

  
   var itemIndex = gridControl.RepositoryItems.Add(new RepositoryItemCheckEdit());
   var columnEdit = gridControl.RepositoryItems[itemIndex] as RepositoryItemCheckEdit;
   columnEdit.ValueChecked = true;
   columnEdit.ValueUnchecked = false;
   gridView.Columns[0].ColumnEdit = columnEdit;
   this.gridView.CustomDrawColumnHeader += gridView_CustomDrawColumnHeader;


 

 


 

GridView Column Header에 Checkbox를 그려주고, 체크동작을 하기위한 이벤트를 구현한다.
     
 void gridView_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e) 
{
            if (e.Column == null) 
                return;
            if (e.Column.AbsoluteIndex != 0)
                return;
            Rectangle rect = e.Bounds;
            rect.Inflate(-1, -1);

            e.Info.InnerElements.Clear();
            e.Painter.DrawObject(e.Info);
            DrawCheckBox(e.Graphics, rect, e.Column.ColumnEdit as RepositoryItemCheckEdit, IsAllSelected());
            e.Handled = true;
}

void DrawCheckBox(Graphics g, Rectangle r, RepositoryItemCheckEdit checkEdit, bool isCheck)
{
            DevExpress.XtraEditors.ViewInfo.CheckEditViewInfo info = default(DevExpress.XtraEditors.ViewInfo.CheckEditViewInfo);
            DevExpress.XtraEditors.Drawing.CheckEditPainter painter = default(DevExpress.XtraEditors.Drawing.CheckEditPainter);
            DevExpress.XtraEditors.Drawing.ControlGraphicsInfoArgs args = default(DevExpress.XtraEditors.Drawing.ControlGraphicsInfoArgs);
            info = (CheckEditViewInfo)checkEdit.CreateViewInfo();
            painter = (CheckEditPainter)checkEdit.CreatePainter();

            info.EditValue = isCheck;
            info.Bounds = r;
            info.CalcViewInfo(g);
            args = new DevExpress.XtraEditors.Drawing.ControlGraphicsInfoArgs(info, new DevExpress.Utils.Drawing.GraphicsCache(g), r);
            painter.Draw(args);
            args.Cache.Dispose();
}

void gridView_MouseUp(object sender, MouseEventArgs e)
{
            if (e.Button == System.Windows.Forms.MouseButtons.Left && e.Clicks == 1)
            {
                GridView gridview = sender as GridView;
                if (gridview != null)
                {
                    GridHitInfo hitinfo = gridview.CalcHitInfo(e.Location);

                    if (hitinfo.InRow == false && hitinfo.InColumn == true)
                    {
                        SetAllCheckBox(!IsAllSelected());
                        if (AffectCheckBoxChange != null)
                            AffectCheckBoxChange(this, null);
                    }

                }
                this.gridView.RefreshData();
                DXMouseEventArgs args = DXMouseEventArgs.GetMouseArgs(e);
                args.Handled = true;
            }
}
반응형
            //RepositoryItem 생성 및 Column Adding
            int editIndex = gridControl.RepositoryItems.Add(new RepositoryItemImageComboBox());
            var edit = gridControl.RepositoryItems[editIndex] as RepositoryItemImageComboBox;
            gridView.Columns["SpectrumTypeOut"].ColumnEdit = edit;

+ Recent posts