SL3 Nav framework

Mar 1, 2010 at 6:48 PM

Hi All, Thanks for taking time to read through my question. Any guidance is really appreciated.

I am using SL3 Nav framework in my LOB application. I m currently using MVVM Light as the framework guidance. 

I have a datagrid consisting of employees and when the "user" clicks on "employee id link" in the datagrid, i am transferring the user to "Edit Page". I would like to transfer the "employee id" as query parameter to "edit page".

The issue here is: I can access the query parameter in the EditStaffView.xaml.cs - which i don't want to do.

// Executes when the user navigates to this page.
        protected override void OnNavigatedTo(NavigationEventArgs e)
            if (this.NavigationContext.QueryString.ContainsKey("staffcode"))
                string title = this.NavigationContext.QueryString["staffcode"];

I would like to retrieve the query parameter in my viewmodel and based on the query parameter, i will perform certain operations. When the constructor is called I would like the view to pass the staffid shown below 
public EditStaffViewModel(int staffId)

            _service = new MBServicesClient();
            if (EditStaff == null)
                EditStaff = new RelayCommand(Save);


            // Register to get all the PropertyChangedMessages broadcasted.
            Messenger.Default.Register(this, typeof (PropertyChangedMessage<>), true);

Any idea how to do this ??

Thanks for the help.