Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/security/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 当用户获得访问权限时,如何启用已禁用的单元格我如何恢复相同的交替行背景_C#_Wpf - Fatal编程技术网

C# 当用户获得访问权限时,如何启用已禁用的单元格我如何恢复相同的交替行背景

C# 当用户获得访问权限时,如何启用已禁用的单元格我如何恢复相同的交替行背景,c#,wpf,C#,Wpf,我在键入特定单元格值为“AAA”时禁用了该单元格。我通过使用Enabled属性设置为false来禁用,并且我还将特定行的背景更改为灰色 void Grid_CurrentCellChanging(object sender,Syncfusion.Windows.ComponentModel. SyncfusionCancelRoutedEventArgs args) { var Table = (sender as GridDataTableModel);

我在键入特定单元格值为“AAA”时禁用了该单元格。我通过使用
Enabled
属性设置为false来禁用,并且我还将特定行的背景更改为灰色

void Grid_CurrentCellChanging(object sender,Syncfusion.Windows.ComponentModel.
      SyncfusionCancelRoutedEventArgs args)
{
        var Table = (sender as GridDataTableModel);
        var rowIndex = Grid.Model.CurrencyManager.CurrentCell.RowIndex;
        var columnIndex = Grid.Model.CurrencyManager.CurrentCell.ColumnIndex;

        if (Grid.Model.CurrencyManager.CurrentCell.Renderer.ControlText=="AA")
        {
            Grid.Model.RowStyles[rowIndex].Enabled = false;
            Grid.Model.RowStyles[rowIndex].Background = Brushes.DarkGray;
            var rowcount = Grid.Model.View.Records.Count;

            if (this.Grid.Model.CurrencyManager.CurrentCell.RowIndex > rowcount)
            {
                Dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle,             new               Action(() =>
                {
                    this.Grid.Model.CurrencyManager.CurrentCell.MoveUp();
                }));
            }

            Dispatcher.BeginInvoke( DispatcherPriority.ApplicationIdle , new Action( () =>
            {
                this.Grid.Model.CurrencyManager.CurrentCell.MoveDown();
            } ));
        }
}

我想在单击相同的禁用行时恢复相同的背景

初始化网格时,需要保存原始背景色。并在用户单击该行时恢复此颜色