<Grid
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:Testing">
    <Grid.Resources>
      <DataTemplate x:Key="temp">
        <Rectangle x:Name="rect" Width="200" Height="100" Fill="Red" Margin="0,0,0,1">
          <local:ParameterList.Parameters>
            <local:Parameter Key="key1" Value="{Binding Name}"/>
            <local:Parameter Key="key2" Value="{Binding DataContext.Count, ElementName=list}"/>
          </local:ParameterList.Parameters>
        </Rectangle>
      </DataTemplate>
    </Grid.Resources>
    <ItemsControl x:Name="list" ItemsSource="{Binding}" ItemTemplate="{StaticResource temp}"
       HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
