Set Rectangle size with Resources
<Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="WPF" Height="300" Width="300"> <UniformGrid> <UniformGrid.Resources> <Style TargetType="{x:Type Rectangle}"> <Setter Property="Height" Value="50" /> <Setter Property="Width" Value="50" /> <Setter Property="Margin" Value="5" /> </Style> </UniformGrid.Resources> <Rectangle Fill="{x:Static SystemColors.ActiveBorderBrush}" /> </UniformGrid> </Window>