The 'search-text' box is not bound to the ViewModel?

Jun 30, 2010 at 8:25 AM

I've watched your MIX10 video and I downloaded the source code for the BookShelf application. However I've a question :

For the loadCommand, you have the following xaml:


<Button Content="Load" Margin="0,0,4,0"
        Command="{StaticResource loadCommand}"
        CommandParameter="{Binding ElementName=searchText, Path=Text}"/>

Is there a reason that you did not add a SearchText to the ViewModel and bind the CommandParameter to that one ?


Jun 30, 2010 at 9:37 AM

There is no right/wrong approach here - it all depends on the conceptual model you want to represent on your view model.

In my perspective the search text was a piece of input to the search operation, rather than something exposed by the view model... hence implemented as parameter.

Jul 6, 2010 at 2:10 PM

OK, Thank you for this answer.