I have a Silverlight 4 project which displays a chart and some buttons to allow the user to change the chart's date range. The date range can also be passed in via a query string parameter - something like http://myserver/MySilverlightPage/#?DateRange=OneMonth - and when the user clicks a button I'd like to update the Url as well.
I understand that the way to do this is to call this.NavigationService.Navigate(new Uri(...))
, but as far as I can tell this can only be done from the Silverlight page code behind. And since I'm using MVVM, all processing of the command takes place in the ViewModel class. Is there a way to call Navigate
or otherwise change the Url from within the ViewModel?
To clariy, the xaml includes the following Button
:
<Button Content="1 Month View"
Command="{Binding OneMonthCommand}" />
And the ViewModel class contains a OneMonthCommand
property:
public ICommand OneMonthCommand { get; set; }
When the button is clicked my ICommand implementation's Execute
method is called. The question is - how can I change the Url from within that method?