Prism Command Binding using Parameter?
Here is a complete solution that worked for me:
Use CommandParameter (as per Dmitry - Spasiba!)
<TextBlock> <Hyperlink CommandParameter="{Binding PersonSelected.PersonKnown2ID}" Command="{Binding NavHomeViewCommand}" > <Run Text="{Binding PersonSelected.PersonKnownName2}" /> </Hyperlink> </TextBlock>
Change DelegateCommand to use object parameter
navHomeViewCommand = new DelegateCommand<object>(NavHomeView);
Command Properties remain unchanged but method changed to use parameter:
private readonly ICommand navHomeViewCommand; public ICommand NavHomeViewCommand { get { return navHomeViewCommand; } } private void NavHomeView(object ID) { int val = Convert.ToInt32(ID); var parameters = new NavigationParameters(); parameters.Add("To", val); _regionManager.RequestNavigate("MainRegion", new Uri("HomeView", UriKind.Relative), parameters); }
You can use 'CommandParameter' property of the Hyperlink.
<Hyperlink Command="{Binding NavHomeViewCommand}" CommandParameter="1" >
<Run Text="{Binding PersonSelected.PersonKnownName}" />
</Hyperlink>