【问题标题】:Custom design of a popup in wpf using c# (telerik )使用 c# (telerik) 在 wpf 中自定义弹出窗口的设计
【发布时间】:2023-03-27 08:55:01
【问题描述】:

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

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

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

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

【问题讨论】:

    标签: c# wpf telerik popup


    【解决方案1】:

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

    【讨论】:

    • :如何删除黑色背景。我无法删除用户控件的背景 :(
    • @dahsra 我图像中的黑色背景来自 Visual Studio XAML 设计器,控件实际上是透明的。默认情况下,用户控件具有透明背景。您一定在某处将背景设置为黑色..
    • 是的,如果我在 XAML 中设置该背景,它仍会显示背景控件
    • @dahsra 如果删除 AntiqueWhite 边框背景会怎样?
    【解决方案2】:

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

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

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

    然后,使用您当前拥有的内容使背景透明,并让它占据 Grid 中的相同单元格,因此它出现在形状的顶部。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-10-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-10-07
      相关资源
      最近更新 更多