Wpf 单击usercontrol项内标签上的事件

Wpf 单击usercontrol项内标签上的事件,wpf,xaml,Wpf,Xaml,您好,我正在尝试在用户控件内的textblock上创建click textblock事件, 有了一个按钮,它很简单,在主窗口上使用buttonbase属性,但在这里 我不确定该怎么办,我将向您展示我的代码: 这是我的用户控件: <Border BorderBrush="Purple" BorderThickness="3" CornerRadius="3" Margin="3" > <DockPanel> <Grid DockPanel.D

您好,我正在尝试在用户控件内的textblock上创建click textblock事件, 有了一个按钮,它很简单,在主窗口上使用buttonbase属性,但在这里 我不确定该怎么办,我将向您展示我的代码: 这是我的用户控件:

 <Border BorderBrush="Purple" BorderThickness="3" CornerRadius="3" Margin="3" >
    <DockPanel>
        <Grid DockPanel.Dock="Left">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="120"/>
            </Grid.ColumnDefinitions>
            <Label Foreground="Blue">Message Number:</Label>
            <Label Foreground="Blue" Grid.Row="1">Title:</Label>
            <Label Foreground="Blue" Grid.Row="2">Message Date:</Label>
            <Label Foreground="Blue" Grid.Row="3">Contact Mail:</Label>
            <Label Foreground="Blue" Grid.Row="4">Message Type:</Label>
            <Label Foreground="Blue" Grid.Row="5">Message Details:</Label>
            <Label x:Name="lblMessageNum" Grid.Column="1"></Label>
            <Label x:Name="lblTitle" Grid.Column="1" Grid.Row="1"></Label>
            <Label x:Name="lblMessageDate" Grid.Column="1" Grid.Row="2"></Label>
            <Label x:Name="lblContactMail" Grid.Column="1" Grid.Row="3"></Label>
            <Label x:Name="lblMessageType" Grid.Column="1" Grid.Row="4"></Label>
            <Label x:Name="lblMessageDetails" Grid.Column="1" Grid.Row="5"></Label>
        </Grid>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <TextBlock  Margin="23,0,0,0" x:Name="tbkRemove">
                <Underline>Remove Message</Underline>
                <TextBlock.Style>
                    <Style TargetType="TextBlock">
                        <Setter Property= "Foreground" Value="Blue"/>
                        <Style.Triggers>
                            <Trigger Property ="IsMouseOver" Value="True">
                                <Setter Property= "Foreground" Value="Red"/>
                            </Trigger>
                       </Style.Triggers>
                    </Style>
                </TextBlock.Style>
            </TextBlock>
            <Border Grid.Row="1"  BorderBrush="Purple" CornerRadius="3" BorderThickness="3" Margin="23,10,6,0">
                <Image x:Name="ImgPic" Width="102" Height="110"></Image>
            </Border>


        </Grid>
    </DockPanel>
</Border>

消息号码:
标题:
留言日期:
联络邮件:
消息类型:
信息详情:
删除消息
在这个usercontrol中,我得到了tbkRemove textblock,它应该有一个事件来从主窗口中删除它自己(所有用户控件),所以click事件的代码应该在主窗口中,但是我如何才能生成这样的事件呢
提前感谢您的帮助

我使用expression blender创建了一个新按钮,它看起来像一个文本块,因此我可以使用buttonbase将其弹出。

我想我理解这个问题,但不完全理解您希望如何处理它。如果您可以为您所讨论的按钮示例添加一些示例代码,可能会有所帮助