tags:

views:

147

answers:

0

Hi,

I have a command that is registered correctly in Unity but when I pass parameters to it, the parameter values seem to be null. I have the command defined in XAML as following (note that I tried with Message.triggers in XAML but this also sent nulls for the parameters).

        <ButtonControls:HeaderButton x:Name="SendEmailbtn"  HorizontalAlignment="Right"
                Margin="0,12,9,12"
                Width="126"
                Grid.Column="1"
                Grid.Row="3"
                Content="Button" 
                IsEnabled="{Binding Path=SendEmailBtnEnabled}"
                PresentationFramework:Message.Attach="ContainerCommand SendEmailCommand(emailTextBox.Text, messageTextBox.Text, bodyTextBox.Text)"
                />

        <!--<ButtonControls:HeaderButton x:Name="SendEmailbtn"
                                     HorizontalAlignment="Right"
                                     Margin="0,12,9,12"
                                     Width="126"
                                     Grid.Column="1"
                                     Grid.Row="3"
                                     Content="Button"
                                     IsEnabled="{Binding Path=SendEmailBtnEnabled}">
            <PresentationFramework:Message.Triggers>
                <PresentationFramework:RoutedMessageTriggerCollection>
                    <ct:EventMessageTrigger EventName="Click">
                        <ct:EventMessageTrigger.Message>
                            <cc:CommandMessage Command="SendEmailCommand">
                                <PresentationFramework:Parameter ElementName="emailTextBox" Path="Text" />
                                <PresentationFramework:Parameter ElementName="messageTextBox" Path="Text" />
                                <PresentationFramework:Parameter ElementName="bodyTextBox" Path="Text" />
                            </cc:CommandMessage>
                        </ct:EventMessageTrigger.Message>
                    </ct:EventMessageTrigger>
                </PresentationFramework:RoutedMessageTriggerCollection>
            </PresentationFramework:Message.Triggers>
        </ButtonControls:HeaderButton>-->

Also in my command which sends an email asynchronously, I need to pass back to the view/view model the result of sending an email (i.e. if it was a success or not). How can I do this without tightly coupling the view model and command?

JD.