Custom design of a popup in wpf using c# (telerik )

夙愿已清 提交于 2019-12-07 17:58:16

问题


I am showing an pop up in a button click event> I have kept a custom user control inside that popup and so whenever the pop is being shown taht custom usercontrol will be displayed.But now i need to modify the custom control . Current custom control inside popup looks like below

but i need the corner to be look like the below image.. How to do it.? I need that sharp corner in my control and i need that sharp corner point whenever the popup been shown

bolow the code of the button and its popup

 <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>

回答1:


Here is an example in 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>




回答2:


In your control for the tooltip, you can use a Grid to draw two things on top of each other.

The first, a Canvas with a custom PathGeometry of the shape you want, this is a good reasource:

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

Then, make the background transparent with what you currently have and have it occupy the same cell in the Grid, so it appears on top of the shape.



来源:https://stackoverflow.com/questions/36766185/custom-design-of-a-popup-in-wpf-using-c-sharp-telerik

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!