title: Border for some cells of a grid in WPF
body: <p>I have a data grid.
  I want to create several borders - not for the entire grid, but for some of the cells.</p>
  
  <p>For example:</p>
  
  <ol>
  <li>column 2 row 2 and 3</li>
  <li>column 4 row 3 and 4.</li>
  </ol>
  
  <p>Attaching my XAML code.</p>
  
  <p>Thanks in advance for answering.</p>
  
  <pre><code>&lt;Grid Grid.Column="1"&gt;
  &lt;Grid.RowDefinitions&gt;
      &lt;RowDefinition Height="38"&gt;&lt;/RowDefinition&gt;
      &lt;RowDefinition Height="38*"&gt;&lt;/RowDefinition&gt;
      &lt;RowDefinition Height="38*"&gt;&lt;/RowDefinition&gt;
      &lt;RowDefinition Height="37*"&gt;&lt;/RowDefinition&gt;
      &lt;RowDefinition Height="38*"&gt;&lt;/RowDefinition&gt;
      &lt;RowDefinition Height="30"&gt;&lt;/RowDefinition&gt;
      &lt;RowDefinition Height="37*"&gt;&lt;/RowDefinition&gt;
      &lt;RowDefinition Height="30"&gt;&lt;/RowDefinition&gt;
  &lt;/Grid.RowDefinitions&gt;
  
  &lt;Grid.ColumnDefinitions&gt;
      &lt;ColumnDefinition Width="0.5*"&gt;&lt;/ColumnDefinition&gt;
      &lt;ColumnDefinition Width="0.05*"&gt;&lt;/ColumnDefinition&gt;
      &lt;ColumnDefinition Width="0.5*"&gt;&lt;/ColumnDefinition&gt;
      &lt;ColumnDefinition Width="0.05*"&gt;&lt;/ColumnDefinition&gt;
      &lt;ColumnDefinition Width="0.5*"&gt;&lt;/ColumnDefinition&gt;
      &lt;ColumnDefinition Width="0.1*"&gt;&lt;/ColumnDefinition&gt;
  &lt;/Grid.ColumnDefinitions&gt;
  &lt;Label Content="Select relay:" HorizontalAlignment="Center" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center"&gt;&lt;/Label&gt;
  &lt;Label Content="Select State:" HorizontalAlignment="Center" Grid.Row="1" Grid.Column="2" VerticalAlignment="Bottom"&gt;&lt;/Label&gt;
  
  &lt;ComboBox x:Name="CBRelayNumber" VerticalAlignment="Center" Grid.Row="0" Grid.Column="2"&gt;
      &lt;ComboBoxItem Content="ALL Relay" HorizontalAlignment="Center" /&gt;
      &lt;ComboBoxItem Content="Relay 1" Tag="0" HorizontalAlignment="Center" /&gt;
      &lt;ComboBoxItem Content="Relay 2" Tag="1" 
  
  &lt;/ComboBox&gt;
  &lt;ComboBox x:Name="CBRelayState" VerticalAlignment="Center" Grid.Row="1" Grid.Column="2"&gt;
      &lt;ComboBoxItem Content="ON" HorizontalAlignment="Center" /&gt;
      &lt;ComboBoxItem Content="OFF" HorizontalAlignment="Center" /&gt;
  &lt;/ComboBox&gt;
  
  &lt;Label Content="Select Delay (msec):" HorizontalAlignment="Center" Grid.Row="0" Grid.Column="4" VerticalAlignment="Bottom" Grid.RowSpan="2"&gt;&lt;/Label&gt;
  &lt;TextBox x:Name="tbAddTime" VerticalAlignment="Center" Grid.Column="4" Grid.Row="1"&gt;&lt;/TextBox&gt;
  &lt;Button Content="Add" x:Name="AddDelay" Grid.Row="2" Grid.Column="4" VerticalAlignment="Center" Click="AddDelay_Click" &gt;&lt;/Button&gt;
  
  &lt;Button Content="Open Several Relays" x:Name="AddSeveralRelay" Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" Click="AddSeveralRelay_Click" &gt;&lt;/Button&gt;
  &lt;Button Content="Add" x:Name="AddRelay" Grid.Row="2" Grid.Column="2" VerticalAlignment="Center" Click="AddRelay_Click" &gt;&lt;/Button&gt;
  
  &lt;Label Content="Times to perform:" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="0" Grid.Row="3"&gt;&lt;/Label&gt;
  &lt;TextBox x:Name="tbLoop" Grid.Column="2" Grid.Row="3" VerticalAlignment="Center"&gt;&lt;/TextBox&gt;
  &lt;Button Content="Save Scenario" x:Name="btnSave" Grid.Row="5" Grid.Column="0" Click="btnSave_Click"&gt;&lt;/Button&gt;
  &lt;Button Content="Load Scenario" x:Name="btnLoad" Grid.Row="7" Grid.Column="0" Click="btnLoad_Click"/&gt;
  &lt;Button Content="Start" x:Name="btnStart" Grid.Row="5" Grid.Column="4" Click="btnStart_Click"&gt;&lt;/Button&gt;
  &lt;Button Content="Clear" x:Name="btnClear" Grid.Row="7" Grid.Column="4" Click="btnClear_Click"&gt;&lt;/Button&gt;
  
  &lt;CheckBox x:Name="cbPostPreAllOFF" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Row="4" Grid.Column="2" Content="Pre-Post Relay OFF" IsChecked="True" Click="cbPostPreAllOFF_Checked"&gt;&lt;/CheckBox&gt;
  </code></pre>
  
  <p></p>