title: Create a custom control in wpf for mahapps tile
body: <p>I wan't to create a custom control for mahapps to make a customize tile control that have binding property for visual to make an icon inside the tile</p>
  
  <p>control xaml code</p>
  
  <pre><code>&lt;Style TargetType="{x:Type local:iTile}"&gt;
      &lt;Setter Property="Template"&gt;
          &lt;Setter.Value&gt;
              &lt;ControlTemplate TargetType="{x:Type local:iTile}"&gt;
                  &lt;controls:Tile Title="{TemplateBinding Title}"
                                 HorizontalTitleAlignment="Left"
                                 HorizontalContentAlignment="Right"
                                 Height="100" Width="100"
                                 Margin="0"
                                 VerticalContentAlignment="Top"&gt;
                      &lt;Rectangle Fill="Black" Height="45" Width="45" Margin="0,10,8,0"&gt;
                          &lt;Rectangle.OpacityMask&gt;
                              &lt;VisualBrush Visual="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Icon}" Stretch="Uniform" /&gt;
                          &lt;/Rectangle.OpacityMask&gt;
                      &lt;/Rectangle&gt;
                  &lt;/controls:Tile&gt;
              &lt;/ControlTemplate&gt;
          &lt;/Setter.Value&gt;
      &lt;/Setter&gt;
  &lt;/Style&gt;
  </code></pre>
  
  <p>control csharp code</p>
  
  <pre><code>public class iTile : Tile
  {
      static iTile()
      {
          DefaultStyleKeyProperty.OverrideMetadata(typeof(iTile), new FrameworkPropertyMetadata(typeof(iTile)));
      }
  
      public static readonly DependencyProperty IconProperty =
      DependencyProperty.Register("Icon", typeof(Object), typeof(iTile), new UIPropertyMetadata());
  
      public Object Icon
      {
          get { return GetValue(IconProperty); }
          set { SetValue(IconProperty, value); }
      }
  }
  </code></pre>
  
  <p>and control use like this</p>
  
  <pre><code>&lt;iControls:iTile Title="Some Title"
                           Icon="{iconPacks:PackIconMaterial Kind=AccountOff}"/&gt;
  </code></pre>
  
  <p>but icon not shown just the title of the tile.</p>