按钮为HyperlinkBut​​ton

时间:2013-05-25 00:49:36

标签: c# wpf silverlight xaml windows-store-apps

我想使用Button,而不是创建HyperlinkBut​​ton来导航到框架中的其他页面。我有这个HyperlinkBut​​ton

<HyperlinkButton NavigateUri="/MyPageName" TargetName="mainFrame" Content="Go To My Page" />

我认为这是可能的,我到目前为止

<Button x:Name="btnView" Content="View">
        <i:Interaction.Triggers>
            <i:EventTrigger EventName="Click">
                <!-- and i dont know what is next here -->
            </i:EventTrigger>
        </i:Interaction.Triggers>
</Button>

任何帮助都会受到重视......

TIA

1 个答案:

答案 0 :(得分:0)

设计HyperlinkBut​​ton的内容。

<HyperlinkButton Name="btn" Margin="340,5,0,0" Background="Transparent" Height="48" VerticalAlignment="Top" Padding="2,0,2,2" BorderBrush="Transparent" Foreground="Black" HorizontalAlignment="Left" Width="110">
  <HyperlinkButton.Content>
    <Grid>
      <Rectangle Fill="#FFC1B7B7" HorizontalAlignment="Stretch" Margin="0" RadiusX="4" RadiusY="4" Stroke="#FF1D1212" StrokeThickness="2" Width="Auto" Grid.Column="1" VerticalAlignment="Top" Height="43" />
      <TextBlock Text="NONE" FontSize="16" Height="20" HorizontalAlignment="Left" Margin="0" Name="tb" Padding="2" VerticalAlignment="Bottom" Width="110" FontFamily="Courier New" FontWeight="Bold" Grid.Column="1" TextAlignment="Center" />
    </Grid>
  </HyperlinkButton.Content>
</HyperlinkButton>