You should consider binding your list of users in Userlist.xaml to a collection of ProfileViewModel instances, then you can just provide the specific ProfileViewModel to the profile.xaml.
In this example, your Userlist.xaml would include:
<UserControl Name="userView">
<!-- other stuff -->
<ItemsControl ItemsSource={Binding Users}>
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding UserName}" />
<Button Content="View User Profile"
Command="{Binding ElementName=userView, Path=DataContext.ViewUserProfileCommand}"
CommandParameter="{Binding}" />
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<!-- other stuff -->
</UserControl>
And your UserlistViewModel would include:
#region Users Property
public const string UsersPropertyName = "Users";
private ObservableCollection<IProfileViewModelViewModel> _users;
public ObservableCollection<IProfileViewModelViewModel> Users
{
get { return _users; }
set
{
if (_users == value)
return;
_users = value;
RaisePropertyChanged(UsersPropertyName);
}
}
#endregion
public RelayCommand<IProfileViewModel> ViewUserProfileCommand
= new RelayCommand<IProfileViewModel>(ViewUserProfileCommandExecute);
private void ViewUserProfileCommandExecute(IUserProfileViewModel userProfileViewModel)
{
// display your profile view here
}
As Reed mentioned above, one way to pass the user profile view model to your other page would be MVVM Light Toolkit's messaging.