devexpress gridcontrol dynamic FixedStyle

124 views Asked by At

I need to fix the current column dynamically , which mean when focused a column , get the column name and fix it . I need your help pls to get it in right way

thanks in advance

GridView1.FocusedColumn.FieldName.Fixed = FixedStyle.Left

1

There are 1 answers

0
DmitryG On

It is not quite clear to me what the logic behind the "I need to fix the current column dynamically", but I believe you can use the following code snippet as a basement:

gridView.FocusedColumnChanged += OnFocusedColumnChanged;
//...
void OnFocusedColumnChanged(object sender, FocusedColumnChangedEventArgs e) {
    var focusedColumn = ((GridView)sender).FocusedColumn;
    if (focusedColumn != null)
        focusedColumn.Fixed = FixedStyle.Left;
}