This project is read-only.

mui:ModernButton.CommandBindings

Nov 14, 2014 at 11:39 PM
it seems it is not possible to bind a command on a modernbutton, because nothing happend.
if possible - what do i wrong?
if not possible - why not? :/
            <mui:ModernButton EllipseDiameter="32" IconWidth="20" IconHeight="20" IconData="{StaticResource IconAdd}">
                <mui:ModernButton.CommandBindings>
                    <CommandBinding Command="ApplicationCommands.New" CanExecute="New_CanExecute" Executed="New_Executed" />
                </mui:ModernButton.CommandBindings>
            </mui:ModernButton>
Nov 15, 2014 at 2:34 AM
this works just fine for me:
<mui:ModernButton Command="{Binding SearchCommand}"
                               Margin="0,0,0,0"
                               Content="search"
                               ToolTip="search projects" />
Marked as answer by kozw on 12/1/2014 at 2:13 PM
Nov 19, 2014 at 6:26 PM
thx for your answer, but of course it this not the same like that what i want. :/
Nov 28, 2014 at 1:28 PM
i changed the source to solve that :/
Dec 4, 2014 at 5:28 PM
Edited Dec 4, 2014 at 5:29 PM
Works fine for me... just didn't use the same specific command nowhere, but I use a lot "NavigationCommands.GoToPage" and some others
Jan 13, 2015 at 6:23 PM
I experienced something similar: a MVVM Light RelayCommand with this body works fine:
toggleIsEditingNumberCommand = new RelayCommand(() => { IsEditingNumber = !IsEditingNumber; });
but when adding some more lines to the lambda body it just stops to work. Don't know if this is somehow related to MVVM Light or something non-async in the lambda body (like it is in Silverlight, whichs won't even compile AFAIR when e.g. calling a service synchronuously). Could you please specify your MVVM-framework?
Jan 30, 2015 at 3:14 AM
Edited Jan 30, 2015 at 3:18 AM
I remember dealing with this in mvvmlight. I just stopped using lambdas as my command method, and instead just always had my command call a method.

for example:
public RelayCommand MyCommand { get; private set;}
private void ExecuteMyCommand()
{
    // do stuff. 
}

MyCommand = new RelayCommand(() => ExecuteMyCommand());
To, this is more readable anyhow.