
{"id":423,"date":"2010-04-07T16:56:28","date_gmt":"2010-04-07T20:56:28","guid":{"rendered":"http:\/\/www.ikriv.com\/blog\/?p=423"},"modified":"2010-04-07T16:56:28","modified_gmt":"2010-04-07T20:56:28","slug":"wpfc-in-desperate-need-of-macros","status":"publish","type":"post","link":"https:\/\/ikriv.com\/blog\/?p=423","title":{"rendered":"WPF\/C#: in desperate need of macros"},"content":{"rendered":"<p>As I mensioned earlier on Microsoft forums (with no response), we desperately need some kind of macro language. I am now developing some GUI using WPF. WPF is a very structured system, but look how many thigns I need to do to route a simple command:<\/p>\n<p>1. In my view model class I add<br \/>\n<code>private DelegateCommand&lt;object&gt; _groupDeleteCommand;<br \/>\npublic DelegateCommand&lt;object&gt; GroupDeleteCommand<br \/>\n{ get { return _groupDeleteCommand; } }<\/code><\/p>\n<p>2. Then in the constructor of said class I need to add<br \/>\n<code>_groupDeleteCommand = new DelegateCommand&lt;object&gt;(OnGroupDelete);<\/code><\/p>\n<p>3. Then in the body of the class I need to add<br \/>\n<code>private void OnGroupDelete(object arg)<br \/>\n{<br \/>\n}<\/code><\/p>\n<p>4. Then in the XAML file I need to add<br \/>\n<code>&lt;MenuItem  Command=\"{Binding GroupDeleteCommand}\" \/&gt;<\/code><\/p>\n<p>Rinse and repeat for every command in the command list. This is <b><font color=\"red\">a lot<\/font><\/b> of duplication. Truckloads of it. I am so annoyed, I took time to write this blog post.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As I mensioned earlier on Microsoft forums (with no response), we desperately need some kind of macro language. I am now developing some GUI using WPF. WPF is a very <a href=\"https:\/\/ikriv.com\/blog\/?p=423\" class=\"more-link\">[&hellip;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"Layout":"","footnotes":""},"categories":[8,12],"tags":[],"class_list":["entry","author-ikriv","post-423","post","type-post","status-publish","format-standard","category-cs","category-wpf"],"_links":{"self":[{"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/423","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=423"}],"version-history":[{"count":0,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/423\/revisions"}],"wp:attachment":[{"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=423"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=423"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=423"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}