Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

C#

Pass parameter to RelayCommand in codebehind

ICommand command = new RelayCommand(x => this.Execute(parameterVariable), this.CanExecute);
https://snipt.net/embed/c5e16b513618c3dc26c78ff56c9c0be1/
https://snipt.net/raw/c5e16b513618c3dc26c78ff56c9c0be1/
c5e16b513618c3dc26c78ff56c9c0be1
csharp
C#
2
2016-12-10T06:03:34
True
False
False
Dec 06, 2013 at 12:50 PM
/api/public/snipt/98976/
pass-parameter-to-relaycommand-in-codebehind
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="n">ICommand</span> <span class="n">command</span> <span class="p">=</span> <span class="k">new</span> <span class="n">RelayCommand</span><span class="p">(</span><span class="n">x</span> <span class="p">=&gt;</span> <span class="k">this</span><span class="p">.</span><span class="n">Execute</span><span class="p">(</span><span class="n">parameterVariable</span><span class="p">),</span> <span class="k">this</span><span class="p">.</span><span class="n">CanExecute</span><span class="p">);</span> </span></pre></div> </td></tr></table>
RelayCommand, WPF
Copyrighted, illegal, or inappropriate content? Email [email protected].