How do I Immediately Validate a Newly Inserted Row in a Silverlight 3 Datagrid?

前端 未结 1 1503
伪装坚强ぢ
伪装坚强ぢ 2021-01-14 04:54

I have a Silverlight 3 tools library with a custom DataGrid user control. This grid has no direct access to the WCF RIA Services entity types so I\'m using reflection to add

相关标签:
1条回答
  • 2021-01-14 05:29

    Just got this working thanks to some help from this question.

    I added the following to the "== Validate data here ==" section in the code from above:

    DataGridRow newRow = this._dataGrid.ChildrenOfType<DataGridRow>().FirstOrDefault();
    if (newRow != null)
    {
        newRow.Loaded += (sender, e) =>
        {
            this._dataGrid.CurrentItem = newItem;
            this._dataGrid.BeginEdit();
        };
    }
    

    This forces the first cell to immediately go into edit mode.

    0 讨论(0)
提交回复
热议问题