title: WPF - How can I place a usercontrol over an AdornedElementPlaceholder?
body: <p><a href="http://img42.imageshack.us/img42/4161/blinkthru.png">alt text http://img42.imageshack.us/img42/4161/blinkthru.png</a></p>
  
  <p>I'm trying to get the validation to not show through my custom modal dialog. I've tried setting the zindex of the dialog and and of the elements in this template. Any ideas?</p>
  
  <p>This is coming from a validation template:</p>
  
  <pre><code>&lt;ControlTemplate x:Key="ValidationTemplate"&gt;
          &lt;DockPanel&gt;
              &lt;TextBlock Foreground="Red" FontSize="20" Panel.ZIndex="-10"&gt;!&lt;/TextBlock&gt;
              &lt;Border Name="validationBorder" BorderBrush="Red" BorderThickness="2" Padding="1" CornerRadius="3" Panel.ZIndex="-10"&gt;
                  &lt;Border.Resources&gt;
                      &lt;Storyboard x:Key="_blink"&gt;
                          &lt;ColorAnimationUsingKeyFrames AutoReverse="True" BeginTime="00:00:00" Storyboard.TargetName="validationBorder" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" RepeatBehavior="Forever"&gt;
                              &lt;SplineColorKeyFrame KeyTime="00:00:1" Value="#00FF0000"/&gt;
                          &lt;/ColorAnimationUsingKeyFrames&gt;
                      &lt;/Storyboard&gt;
                  &lt;/Border.Resources&gt;
                  &lt;Border.Triggers&gt;
                      &lt;EventTrigger RoutedEvent="FrameworkElement.Loaded"&gt;
                          &lt;BeginStoryboard Storyboard="{StaticResource _blink}" /&gt;
                      &lt;/EventTrigger&gt;
                  &lt;/Border.Triggers&gt;
                  &lt;AdornedElementPlaceholder/&gt;
              &lt;/Border&gt;
          &lt;/DockPanel&gt;
      &lt;/ControlTemplate&gt;
  </code></pre>
  
  <p>The dialog:</p>
  
  <pre><code>&lt;UserControl
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      x:Class="GunMiser.Controls.PendingChangesConfirmationDialog"
      Height="768" Width="1024" mc:Ignorable="d"&gt;
      &lt;Grid Background="White"&gt;
          &lt;Rectangle x:Name="MainRectangle" Margin="0,0,0,0" Style="{DynamicResource UserControlOverlayRectangleStyle}" Opacity="0.85"/&gt;
          &lt;Border Margin="288,250,278,288" Background="#FF868686" BorderBrush="Black" BorderThickness="1"&gt;
              &lt;Border.Effect&gt;
                  &lt;DropShadowEffect Color="#FFB6B2B2"/&gt;
              &lt;/Border.Effect&gt;
              &lt;TextBlock x:Name="textBlockMessage" Margin="7,29,7,97" TextWrapping="Wrap" d:LayoutOverrides="VerticalAlignment" TextAlignment="Center"/&gt;
          &lt;/Border&gt;
          &lt;Button x:Name="OkButton" Click="OkButton_Click" Margin="313,0,0,328" VerticalAlignment="Bottom" Height="24" Content="Save Changes" Style="{DynamicResource GunMiserButtonStyle}" HorizontalAlignment="Left" Width="103"/&gt;
          &lt;Button Click="CancelButton_Click" Margin="453.294,0,456,328" VerticalAlignment="Bottom" Height="24" Content="Cancel Changes" Style="{DynamicResource GunMiserButtonStyle}"/&gt;
          &lt;Button Click="CancelActionButton_Click" Margin="0,0,304,328" VerticalAlignment="Bottom" Height="24" Content="Go Back" Style="{DynamicResource GunMiserButtonStyle}" HorizontalAlignment="Right" Width="114.706"/&gt;
      &lt;/Grid&gt;
  &lt;/UserControl&gt;
  </code></pre>
  
  <p>And the overall window is:</p>
  
  <pre><code>&lt;Window x:Class="GunMiser.Views.Shell"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:cal="http://www.codeplex.com/CompositeWPF"
      xmlns:controls="clr-namespace:GunMiser.Controls;assembly=GunMiser.Controls"
      Title="Gun Miser"
      Height="768" Width="1024"&gt;
      &lt;Canvas&gt;
          &lt;controls:PendingChangesConfirmationDialog x:Name="PendingChangesConfirmationDialog" HorizontalAlignment="Stretch" Margin="0,0,0,0" VerticalAlignment="Stretch" Width="1008" Height="730" Visibility="Collapsed" Panel.ZIndex="100" /&gt;
          &lt;ContentControl x:Name="FilterRegion" cal:RegionManager.RegionName="FilterRegion" Width="326" Height="656" Canvas.Top="32" VerticalAlignment="Top" HorizontalAlignment="Left" /&gt;
          &lt;ContentControl Name="WorkspaceRegion" cal:RegionManager.RegionName="WorkspaceRegion" Width="678" Height="726" Canvas.Left="330" VerticalAlignment="Top" HorizontalAlignment="Left"/&gt;
          &lt;Button Click="GunsButton_Click" Width="75" Height="25" Content="Guns" Canvas.Top="3" Style="{DynamicResource GunMiserButtonStyle}"/&gt;
          &lt;Button Click="OpticsButton_Click" Width="75" Height="25" Content="Optics" Canvas.Left="81" Canvas.Top="3" Style="{DynamicResource GunMiserButtonStyle}"/&gt;
          &lt;Button Click="SettingsButton_Click" Width="56" Height="28" Content="Settings" Canvas.Left="944" Style="{DynamicResource GunMiserButtonStyle}" HorizontalAlignment="Left" VerticalAlignment="Top"/&gt;
          &lt;Button Click="AccessoriesButton_Click" Width="75" Height="25" Content="Accessories" Canvas.Left="239" Canvas.Top="3" Style="{DynamicResource GunMiserButtonStyle}"/&gt;
          &lt;Button Click="AmmunitionButton_Click" Width="75" Height="25" Content="Ammunition" Canvas.Left="160" Canvas.Top="3" Style="{DynamicResource GunMiserButtonStyle}"/&gt;
  
      &lt;/Canvas&gt;
  &lt;/Window&gt;
  </code></pre>