使用c#(telerik)在wpf中自定义设置弹出窗口

时间:2016-04-21 10:01:03

标签: c# wpf telerik popup

我正在按钮点击事件中弹出一个>我在弹出窗口中保留了一个自定义用户控件,因此每当弹出窗口显示时,都会显示自定义用户控件。但现在我需要修改自定义控件。 弹出窗口中的当前自定义控件如下所示

enter image description here

但我需要角落看起来像下面的图像..怎么做。?我需要控制中的那个尖角,每当弹出窗口显示时我都需要那个尖角点

enter image description here

弹出按钮的代码及其弹出窗口

 <telerik:RadButton Name="btnH" Grid.Column="1" HorizontalAlignment="Left" Margin="444,56,0,0" Grid.Row="2" VerticalAlignment="Top" 
                 Width="23" Height="23" BorderThickness="6" BorderBrush="#4E4E4E" Click="btnH_Click" >
            <Image Source="Images/help.png" />
        </telerik:RadButton>
        <Popup PopupAnimation="Fade" Placement="Mouse" AllowsTransparency="True" StaysOpen="False" x:Name="TooltipPopup" >
            <Border Background="AntiqueWhite" CornerRadius="0" BorderThickness="1">
                <StackPanel Margin="1" Orientation="Horizontal" >
                    <local:UCToolTip></local:UCToolTip>
                </StackPanel>
            </Border>
        </Popup>

2 个答案:

答案 0 :(得分:2)

以下是XAML中的一个示例:

<Grid Width="300" Height="200">
    <Grid.RowDefinitions>
        <RowDefinition/>
        <RowDefinition Height="Auto"/>
    </Grid.RowDefinitions>
    <Grid Background="Orange">
        <!--Your content here-->
    </Grid>
    <Polygon Grid.Row="1"
        Points="0,0 15,0, 0,30" Stroke="Orange" Fill="Orange" />
</Grid>

enter image description here

答案 1 :(得分:1)

在您对工具提示的控制中,您可以使用网格在彼此之上绘制两个东西。

第一个是Canvas,它具有您想要的自定义PathGeometry形状,这是一个很好的资源:

https://msdn.microsoft.com/en-us/library/ms747393(v=vs.100).aspx

然后,使背景透明,并使其占据网格中相同的单元格,使其显示在网格的顶部。