<Window x:Class="DependencyPropertyExample.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:DependencyPropertyExample"
    Title="DependencyPropertyExample" Height="300" Width="300"
    >
  <Window.Resources>
    
    <!-- Example 18-17. Using property binding -->
    
    <ControlTemplate TargetType="{x:Type local:MyCustomControl}" x:Key="myTemplate">
      <Grid>
        <Line Stroke="{TemplateBinding StripeBrush}" StrokeThickness="1"
              X1="0" Y1="0" X2="100" Y2="100" />
      </Grid>
    </ControlTemplate>

    <!-- End of Example 18-17. -->


    <!-- Example 18-21. Using a ContentPresenter -->
    
    <ControlTemplate TargetType="{x:Type local:MyContentControl}" x:Key="myTemplate2">
      <Grid>
        <Rectangle Fill="White" />
        <ContentPresenter />
      </Grid>
    </ControlTemplate>

    <!-- End of Example 18-21 -->


    <!-- Example 18-22. ContentPresenter and HeaderedContentControl -->
    
    <ControlTemplate TargetType="{x:Type local:MyHeaderedContentControl}" x:Key="myTemplate3">
      <Grid>
        <Grid.RowDefinitions>
          <RowDefinition />
          <RowDefinition />
        </Grid.RowDefinitions>

        <ContentPresenter Grid.Row="0" Content="{TemplateBinding Content}" />
        <ContentPresenter Grid.Row="1" Content="{TemplateBinding Header}" />
      </Grid>
    </ControlTemplate>

    <!-- End of Example 18-22 -->


    <!-- Example 18-25. Specifying a placeholder with a property -->
    
    <ControlTemplate TargetType="{x:Type local:ControlWithPlaceholder}" x:Key="myTemplate4">
      <Grid local:ControlWithPlaceholder.IsMyPlaceholder="True" />
    </ControlTemplate>

    <!-- End of Example 18-25. -->

  </Window.Resources>
    <Grid Width="100" Height="100">
      <local:MyCustomControl StripeBrush="Blue" />
      <Button local:ElementWithAttachedProp.IsSkewed="True" />

      <!-- Example 18-5. Property element syntax -->
      
      <Button>
        <Button.Background>
          <SolidColorBrush Color="Blue" />
        </Button.Background>
        <Grid.Row>1</Grid.Row>
        <local:ElementWithAttachedProp.IsSkewed>
          True
        </local:ElementWithAttachedProp.IsSkewed>
      </Button>

      <!-- End of Example 18-5 -->

      <Button x:Name="myButton" Width="75" Height="24" />
    </Grid>
</Window>
