The problem with the above Hyperlinkbutton, AFAIK is that the Run Text is not bindable, so you end up having to repeat that TextBlock/Underline/Run pattern for every hyperlink button. Far better would be to make it a style.
For example if you try this, it will not work and an UnhandledException occurs
<HyperlinkButton Width="Auto" Height="Auto" Margin="2"
Content="{Binding DoctorName}"
Command="{Binding ElementName=scheduleView,
Path=DataContext.NavigateToAppointmentsDetailCommand}"
CommandParameter="{Binding DoctorName}">
<HyperlinkButton.Template>
<ControlTemplate>
<TextBlock>
<Underline>
<Run Text="{TemplateBinding Content}"/>
</Underline>
</TextBlock>
</ControlTemplate>
</HyperlinkButton.Template>
</HyperlinkButton>
The only way I found to fix this where the hyperlink text was also bindable was to use a fake underline rectangle and a regular button. I then show the underline (fake rectangle) based on whether the Pointer is over the button. Here is the relevant code:
Not the best solution but it is bindable for the content (link text), and its a generic solution.
<Button Width="Auto" Height="Auto" Margin="2"
Style="{StaticResource HyperLinkButtonStyle}"
Content="{Binding DoctorName}">
</Button>
<Storyboard>
<ObjectAnimationUsingKeyFrames
Storyboard.TargetProperty="(UIElement.Visibility)"
Storyboard.TargetName="rect">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="FocusStates"/>
</VisualStateManager.VisualStateGroups>
<StackPanel Orientation="Vertical">
<TextBlock x:Name="txt"
Text="{TemplateBinding Content}"
HorizontalAlignment="Center"
FontFamily="Segoe UI" FontSize="18" FontWeight="Thin"/>
<Rectangle x:Name="rect" Fill="White" Height="2" Visibility="Collapsed"
VerticalAlignment="Top" HorizontalAlignment="Stretch"/>
</StackPanel>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>