Dynamically disabling commands.

Pertanyaan Dynamically disabling commands.

  • 15 Mei 2008 17:59
     
     

     

    I have a command that needs to be disabled if certain condition is met. I understand you can't change activities at runtime. Thus, I tried to set my command's command.Grammar.Enabled to false. It doesn't seem to do anything. Is there any way to disable a command?

     

     

Semua Balasan

  • 22 Mei 2008 14:17
     
     
    Have you tried disabling the command itselfinstead f the grammar by setting CommandActivity.Enabled to false?

     

  • 22 Mei 2008 14:25
     
     
    I have, however, it doesn't work because you can't make changes to a workflow activity at runtime. Setting Enabled property to false on an activity would cause an InvalidOperationException to be thrown.