WPF: Binding to commands in code behind

Posted by sofri on Stack Overflow See other posts from Stack Overflow or by sofri
Published on 2010-06-17T08:09:38Z Indexed on 2010/06/17 8:13 UTC
Read the original article Hit count: 643

Filed under:
|
|
|

Hi,

I have an WPF Microsoft Surface Applikation and I'm using MVVM-Pattern.

I have some buttons that are created in code behind. And I would like to bind commands to them but I only know how that works in the XAML like this:

<Custom:SurfaceButton Command="{Binding SaveReservationCommandBinding, Mode=OneWay}"/> 

But I cannot do it like this because my buttons do not exist in the XAML, only in the code behind.

So how would a command binding like that works in code behind?

© Stack Overflow or respective owner

Related posts about c#

Related posts about wpf