16
You could just handle the click event:
<Hyperlink Click="Hyperlink_Click">Link</Hyperlink>
private void Hyperlink_Click(object sender, RoutedEventArgs e)
{
Dialogue diag = new Dialogue();
diag.Show();
}
You could also go crazy with XAML:
<Hyperlink>
<Hyperlink.Style>
<Style TargetType="{x:Type Hyperlink}">
<Style.Triggers>
<EventTrigger RoutedEvent="Hyperlink.Click">
<BeginStoryboard>
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility">
<Storyboard.Target>
<local:Dialogue />
</Storyboard.Target>
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Style.Triggers>
</Style>
</Hyperlink.Style>
<Hyperlink.Inlines>
<Run Text="Open Dialogue"/>
</Hyperlink.Inlines>
</Hyperlink>
This however is very problematic since once the dialogue is closed it cannot be reopened, that means when you click the hypelink again an exception will be thrown.
Using interactivity you could do this without such problems (needs a reference to the Blend SDK though):
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
<Hyperlink>
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<t:Creat