Mega Code Archive

 
Categories / C# / WPF
 

Change Button Alignment, Margin, FontSize and Padding in Style Setting

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"       xmlns:s="clr-namespace:System;assembly=mscorlib">     <Page.Resources>         <Style TargetType="{x:Type Button}">             <Setter Property="HorizontalAlignment" Value="Center" />             <Setter Property="Margin" Value="12" />             <Setter Property="FontSize" Value="12pt" />             <Setter Property="Padding" Value="10" />         </Style>     </Page.Resources>     <StackPanel>         <Button>             <x:Static Member="s:DateTime.Now" />         </Button>     </StackPanel> </Page>