Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/308.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在wpf中创建关闭弹出窗口的圆形交叉按钮?_C#_Wpf_Cornerradius_Wpf Style - Fatal编程技术网

C# 如何在wpf中创建关闭弹出窗口的圆形交叉按钮?

C# 如何在wpf中创建关闭弹出窗口的圆形交叉按钮?,c#,wpf,cornerradius,wpf-style,C#,Wpf,Cornerradius,Wpf Style,我在工作的wpf滑块,我想在滑块控制交叉轮按钮,我已经附加了图像,你能帮我什么风格我应该写得到附加 我试着用下面的方法,但对我无效,因为它是根据 <Style x:Key="RoundCorner" TargetType="{x:Type Button}"> <Setter Property="HorizontalContentAlignment" Value="Center"/> <Setter Property="

我在工作的wpf滑块,我想在滑块控制交叉轮按钮,我已经附加了图像,你能帮我什么风格我应该写得到附加

我试着用下面的方法,但对我无效,因为它是根据

<Style x:Key="RoundCorner" TargetType="{x:Type Button}">
            <Setter Property="HorizontalContentAlignment" Value="Center"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="Padding" Value="1"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Grid x:Name="grid">
                            <Border x:Name="border" Background="Black" CornerRadius="15" BorderBrush="White" BorderThickness="1">
                                <ContentPresenter HorizontalAlignment="Center" TextElement.FontFamily="Arial Rounded MT Bold" VerticalAlignment="Center" TextElement.FontWeight="Bold"></ContentPresenter>
                            </Border>
                        </Grid>
                        <!--<ControlTemplate.Triggers>
                            <Trigger Property="IsPressed" Value="True">
                                <Setter Property="Background" TargetName="border">
                                    <Setter.Value>
                                        <RadialGradientBrush GradientOrigin="0.496,1.052">
                                            <RadialGradientBrush.RelativeTransform>
                                                <TransformGroup>
                                                    <ScaleTransform CenterX="0.5" CenterY="0.5" ScaleX="0.5" ScaleY="0.5"/>
                                                    <TranslateTransform X="0.02" Y="0.02"/>
                                                </TransformGroup>
                                            </RadialGradientBrush.RelativeTransform>
                                        </RadialGradientBrush>
                                    </Setter.Value>
                                </Setter>
                            </Trigger>
                        </ControlTemplate.Triggers>-->
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style


一种方法是使用dingbat字体

<Button FontFamily="Wingdings 2">U</Button>
U

对于厚圆形按钮,“U”可以替换为“V”。它是区分大小写的。我的意思是用“u”代替“u”会产生不同的结果。

编辑Slider的ControlTemplate并将您的样式按钮添加到现有的Slider模板中。停靠有助于将按钮正确放置在滑块上

是否可以发布您的尝试请使用图像视图而不是按钮,并将pgn图像作为源,圆圈周围有透明像素。