C# 如何基于默认样式创建圆边按钮样式
你好 我想知道如何使用本文中的默认样式使按钮看起来像这样: 我发现一些文章在content presenter之后添加了这一行,但它非常全面:C# 如何基于默认样式创建圆边按钮样式,c#,templates,uwp,C#,Templates,Uwp,你好 我想知道如何使用本文中的默认样式使按钮看起来像这样: 我发现一些文章在content presenter之后添加了这一行,但它非常全面: <Ellipse Name="BorderCircle" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="2"/> 谢谢, NicoTing这将在按钮中为您提供圆形边缘,您可以使用UWPCommunityToolkit进行阴影处理 不带UWPCommunityToolki
<Ellipse Name="BorderCircle" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="2"/>
谢谢,NicoTing这将在按钮中为您提供圆形边缘,您可以使用UWPCommunityToolkit进行阴影处理 不带UWPCommunityToolkit
<Button Style="{StaticResource DefaultButtonStyle}" Content="Sign In" Background="#0086f1" Foreground="White" Height="35" Width="150"/>
XAML
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<controls:DropShadowPanel BlurRadius="8"
ShadowOpacity="0.7"
OffsetX="2"
OffsetY="2"
Color="Black"
VerticalAlignment="Center"
HorizontalAlignment="Center">
<Button Style="{StaticResource DefaultButtonStyle}" Background="#0086f1"
Foreground="White" Content="Sign In" Height="35" Width="150"/>
</controls:DropShadowPanel>
</StackPanel>
结果
<Button Style="{StaticResource DefaultButtonStyle}" Content="Sign In" Background="#0086f1" Foreground="White" Height="35" Width="150"/>
UWP社区工具包说明
<Button Style="{StaticResource DefaultButtonStyle}" Content="Sign In" Background="#0086f1" Foreground="White" Height="35" Width="150"/>
使用
矩形
<Grid x:Name="RootGrid"> <!-- Delete Background -->
....
<Rectangle RadiusX="10" RadiusY="10" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="{TemplateBinding BorderThickness}"/>
<ContentPresenter x:Name="ContentPresenter" AutomationProperties.AccessibilityView="Raw" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTransitions="{TemplateBinding ContentTransitions}" Content="{TemplateBinding Content}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Grid>
....
你有没有研究过-是的,这就是我说的添加椭圆,但它太圆了编辑不起作用,我在默认按钮样式的contentpresenter行之后添加了它。你能在帖子中附加输出(使用我的解决方案时)吗?谢谢你的回答,但我需要的是应用默认按钮样式的半径,我在问题中的文章中的代码好的,我会更新答案,使用uwp社区工具包是使用shadow和effectsOkay的最佳方式,您能添加一个使用该工具包的示例吗?谢谢