The default style of the button is not recommended for direct use and should always be used by other styles in the BasedOn mode.
All buttons that inherit this style can use the additional properties defined in IconElement to control the properties of the geometry in the button.
All buttons that inherit this style can use the BorderElement.CornerRadius attached property to control the fillet size of the button.
Example:
1 2 3 4 5
<StackPanelOrientation="Horizontal"> <ButtonContent="This is a button"/> <ButtonContent="This is a button"Margin="10,0,0,0"hc:BorderElement.CornerRadius="15"/> <ButtonContent="This is a button"Margin="10,0,0,0"hc:IconElement.Geometry="{StaticResource GithubGeometry}"/> </StackPanel>
ButtonPrimary : ButtonBaseStyle
Main Button
Example:
1 2 3 4 5
<StackPanelOrientation="Horizontal"> <ButtonStyle="{StaticResource ButtonPrimary}"Content="This is a button"/> <ButtonStyle="{StaticResource ButtonPrimary}"Content="This is a button"Margin="10,0,0,0"hc:BorderElement.CornerRadius="15"/> <ButtonStyle="{StaticResource ButtonPrimary}"Content="This is a button"Margin="10,0,0,0"hc:IconElement.Geometry="{StaticResource GithubGeometry}"/> </StackPanel>
ButtonSuccess : ButtonBaseStyle
Success button
Example:
1 2 3 4 5
<StackPanelOrientation="Horizontal"> <ButtonStyle="{StaticResource ButtonSuccess}"Content="This is a button"/> <ButtonStyle="{StaticResource ButtonSuccess}"Content="This is a button"Margin="10,0,0,0"hc:BorderElement.CornerRadius="15"/> <ButtonStyle="{StaticResource ButtonSuccess}"Content="This is a button"Margin="10,0,0,0"hc:IconElement.Geometry="{StaticResource GithubGeometry}"/> </StackPanel>
ButtonInfo : ButtonBaseStyle
Information button
Example:
1 2 3 4 5
<StackPanelOrientation="Horizontal"> <ButtonStyle="{StaticResource ButtonInfo}"Content="This is a button"/> <ButtonStyle="{StaticResource ButtonInfo}"Content="This is a button"Margin="10,0,0,0"hc:BorderElement.CornerRadius="15"/> <ButtonStyle="{StaticResource ButtonInfo}"Content="This is a button"Margin="10,0,0,0"hc:IconElement.Geometry="{StaticResource GithubGeometry}"/> </StackPanel>
ButtonWarning : ButtonBaseStyle
Warning button
Example:
1 2 3 4 5
<StackPanelOrientation="Horizontal"> <ButtonStyle="{StaticResource ButtonWarning}"Content="This is a button"/> <ButtonStyle="{StaticResource ButtonWarning}"Content="This is a button"Margin="10,0,0,0"hc:BorderElement.CornerRadius="15"/> <ButtonStyle="{StaticResource ButtonWarning}"Content="This is a button"Margin="10,0,0,0"hc:IconElement.Geometry="{StaticResource GithubGeometry}"/> </StackPanel>
ButtonDanger : ButtonBaseStyle
Danger button
Example:
1 2 3 4 5
<StackPanelOrientation="Horizontal"> <ButtonStyle="{StaticResource ButtonDanger}"Content="This is a button"/> <ButtonStyle="{StaticResource ButtonDanger}"Content="This is a button"Margin="10,0,0,0"hc:BorderElement.CornerRadius="15"/> <ButtonStyle="{StaticResource ButtonDanger}"Content="This is a button"Margin="10,0,0,0"hc:IconElement.Geometry="{StaticResource GithubGeometry}"/> </StackPanel>
ButtonDefault : ButtonBaseStyle
Default button
Example:
1 2 3 4 5
<StackPanelOrientation="Horizontal"> <ButtonStyle="{StaticResource ButtonDefault}"Content="This is a button"/> <ButtonStyle="{StaticResource ButtonDefault}"Content="This is a button"Margin="10,0,0,0"hc:BorderElement.CornerRadius="15"/> <ButtonStyle="{StaticResource ButtonDefault}"Content="This is a button"Margin="10,0,0,0"hc:IconElement.Geometry="{StaticResource GithubGeometry}"/> </StackPanel>
ButtonIcon : ButtonBaseStyle
This style is recommended if you only want to display the geometry button.
This style is recommended if you want to fully customize the content of the button. The content in ButtonCustom is entirely up to you. In addition, you can switch the background with additional properties in BackgroundSwitchElement:
Example:
1
<Button Height="30" Padding="10,0" Background="Black" Foreground="White" Content="This is a button" Style="{StaticResource ButtonCustom}" hc:BackgroundSwitchElement.MouseHoverBackground="Red" hc:BackgroundSwitchElement.MouseDownBackground="PaleVioletRed"/>