CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2004
    Location
    Leamington Spa, UK
    Posts
    202

    Validation 'before' setting value or issuing command

    Greetings,

    I am relatively new to WPF and have an issue relating to validation with DataGrid control. I have read this article (http://msdn.microsoft.com/en-us/magazine/ff714593.aspx) which covers three different ways to validate, but none of them seem to address how to prevent setting a value or calling a undo/redo command before all validation is carried out.

    I want to ensure that only positive numbers can be entered into the cells. I have set a validation rule that checks if the cell contains a negative number, and I handle the DataGrid's CellEditEnding event to know when to actually change the number used in the model layer. The problem is that CellEditEnding is called before the validation rule. By the time the validation rule catches the problem, the number in the model has already been set. What I need is CellEditEnded, but it appears this event only exist in the Silvelight version of DataGrid.

    Any ideas?

    Thanks

  2. #2
    Join Date
    Dec 2004
    Location
    Leamington Spa, UK
    Posts
    202

    Re: Validation 'before' setting value or issuing command

    Anyone?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured