Windows Forms Action Framework [modified]
-
One thing I like in Java is that their UI elements can all be interconnected around an Action object. You create an AbstractAction with an Icon and a description string, and then you can associate it with any controls, which will all have the same action when activated (click a button, select a menu item, click a toolbar button, etc...), have the same description, and are all enabled and disabled together, all that through the Action object. I haven't tested to see if changing the icon and the description also cascades. Is there a similar functionality in C# 2.0? Did someone write some class with this functionality? I realize that it's not very hard to code by oneself, but if I can use a proven implementation, or work with someone else, all the better. EDIT : precised that I want .NET 2.0 This has been added to the framework in C# 3.0, but I must use .NET 2.0
"Computer Science is no more about computers than astronomy is about telescopes." - Edsger Dijkstra
modified on Tuesday, October 14, 2008 12:01 PM
-
One thing I like in Java is that their UI elements can all be interconnected around an Action object. You create an AbstractAction with an Icon and a description string, and then you can associate it with any controls, which will all have the same action when activated (click a button, select a menu item, click a toolbar button, etc...), have the same description, and are all enabled and disabled together, all that through the Action object. I haven't tested to see if changing the icon and the description also cascades. Is there a similar functionality in C# 2.0? Did someone write some class with this functionality? I realize that it's not very hard to code by oneself, but if I can use a proven implementation, or work with someone else, all the better. EDIT : precised that I want .NET 2.0 This has been added to the framework in C# 3.0, but I must use .NET 2.0
"Computer Science is no more about computers than astronomy is about telescopes." - Edsger Dijkstra
modified on Tuesday, October 14, 2008 12:01 PM
There's WPF commands. MSDN docs: http://msdn.microsoft.com/en-us/library/ms752308.aspx[^] Microsoft blog: http://www.microsoft.com/belux/msdn/nl/community/columns/jdruyts/wpf_commandpattern.mspx[^] Article here on CP: http://www.codeproject.com/KB/WPF/WpfCommandPatternApplied.aspx[^] Josh talking about them: http://joshsmithonwpf.wordpress.com/2008/03/18/understanding-routed-commands/[^]
Simon
-
There's WPF commands. MSDN docs: http://msdn.microsoft.com/en-us/library/ms752308.aspx[^] Microsoft blog: http://www.microsoft.com/belux/msdn/nl/community/columns/jdruyts/wpf_commandpattern.mspx[^] Article here on CP: http://www.codeproject.com/KB/WPF/WpfCommandPatternApplied.aspx[^] Josh talking about them: http://joshsmithonwpf.wordpress.com/2008/03/18/understanding-routed-commands/[^]
Simon
Oh, cool. Is there anything in .NET 2.0, though? (I forgot to mention that, sorry)
"Computer Science is no more about computers than astronomy is about telescopes." - Edsger Dijkstra
-
Oh, cool. Is there anything in .NET 2.0, though? (I forgot to mention that, sorry)
"Computer Science is no more about computers than astronomy is about telescopes." - Edsger Dijkstra
Can't think of anything. (That doesn't mean that there isn't. the framework is too big for me to remember everything). Last time I wrote an in .net 2.0 thought I wrote my own command handling framework, which I used on several projects.
Simon