Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. BusyIndicator with uncommited new row in Datagrid throws exception

BusyIndicator with uncommited new row in Datagrid throws exception

Scheduled Pinned Locked Moved WPF
help
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AbhijeetB
    wrote on last edited by
    #1

    Hi, In my View I have a datagrid and a 'Undo' button. On 'Undo' I am showing a BusyIndicator. Suppose, 1) I try to add a new row in the datagrid 2) Datagrid row goes into the error state because of some validation failure 3) While datagrid is in edit mode, without loosing focus on the datagrid, I presses a shortcut 'Ctrl+Z' to Undo changes Following exception occurs:- System.Windows.Media.Animation.AnimationException: Cannot animate the 'IsEnabled' property on a 'System.Windows.Controls.ContentControl' using a 'System.Windows.Media.Animation.ObjectAnimationUsingKeyFrames'. For details see the inner exception. ---> System.InvalidOperationException: 'NewItemPlaceholderPosition' is not allowed during a transaction begun by 'AddNew'. Actually on DataGrid LostkeyboardFocus i explicitly CommitEdit and CommitNew for the datagrid. So, if I press the 'Undo' button with mouse everything works fine. But if I presses a shortcut while datagrid is in edit mode and focus is still in the datagrid, then the BusyIndicator, while setting status to BUSY, tries to change IsEnabled of the datagrid and the exception occurs. Please help me if anyone has a solution

    M 1 Reply Last reply
    0
    • A AbhijeetB

      Hi, In my View I have a datagrid and a 'Undo' button. On 'Undo' I am showing a BusyIndicator. Suppose, 1) I try to add a new row in the datagrid 2) Datagrid row goes into the error state because of some validation failure 3) While datagrid is in edit mode, without loosing focus on the datagrid, I presses a shortcut 'Ctrl+Z' to Undo changes Following exception occurs:- System.Windows.Media.Animation.AnimationException: Cannot animate the 'IsEnabled' property on a 'System.Windows.Controls.ContentControl' using a 'System.Windows.Media.Animation.ObjectAnimationUsingKeyFrames'. For details see the inner exception. ---> System.InvalidOperationException: 'NewItemPlaceholderPosition' is not allowed during a transaction begun by 'AddNew'. Actually on DataGrid LostkeyboardFocus i explicitly CommitEdit and CommitNew for the datagrid. So, if I press the 'Undo' button with mouse everything works fine. But if I presses a shortcut while datagrid is in edit mode and focus is still in the datagrid, then the BusyIndicator, while setting status to BUSY, tries to change IsEnabled of the datagrid and the exception occurs. Please help me if anyone has a solution

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      Sorry that I'm not going to be able to help, I have a basic design principle that will not allow the user to add rows to a grid, I insist that a dialog or detail panel is used for all but the most trivial editing process. It eliminates all sorts of issues I see posted here!

      Never underestimate the power of human stupidity RAH

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups