I'm trying to create a custom button control with Blend (I have to admit that it's my first try with Blend) for my VS project.
1) I started by creating an empty WPF app in Blend an then modified the ControlTemplate of the button: I added a path and some eventbased coloring stuff:
<ControlTemplate x:Key="ButtonControlTemplate1" TargetType="{x:Type Button}">
<ControlTemplate.Resources>
<Storyboard x:Key="OnMouseEnter1">
<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="path">
<EasingColorKeyFrame KeyTime="0:0:1" Value="#FF4242C5"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="OnMouseDown1">
<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="path">
<EasingColorKeyFrame KeyTime="0" Value="#FF2D7957"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>
</ControlTemplate.Resources>
<Grid>
<Path x:Name="path" Data="M55.279307,7.1937681 L71.051681,25.658582 74.898866,11.040298 92.210133,27.966732 92.594819,36.045257 67.97435,43.7385 36.04509,43.7385 12.963697,42.584684 7.5777354,24.119657 C7.5777354,24.119657 55.279307,7.1937681 55.279307,7.1937681 z" Fill="#FF2D2D79" HorizontalAlignment="Stretch" Margin="33.352,1.695,41.046,10" Stretch="Fill" Stroke="Black" Width="Auto"/>
</Grid>
<ControlTemplate.Triggers>
<EventTrigger RoutedEvent="UIElement.MouseEnter" SourceName="path">
<BeginStoryboard x:Name="OnMouseEnter1_BeginStoryboard1" Storyboard="{StaticResource OnMouseEnter1}"/>
</EventTrigger>
<EventTrigger RoutedEvent="UIElement.MouseLeave" SourceName="path">
<StopStoryboard BeginStoryboardName="OnMouseEnter1_BeginStoryboard1"/>
</EventTrigger>
<EventTrigger RoutedEvent="UIElement.MouseDown" SourceName="path">
<BeginStoryboard x:Name="OnMouseDown1_BeginStoryboard" Storyboard="{StaticResource OnMouseDown1}"/>
</EventTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
2) Finally, I made this button into a UserControl
3) I placed the UserControl in my empty wpf application.
So far it works fine. But, my task is to provide a huge size of buttons, each button with a different shape (meaning the path of each button holds different coordinates).
What do you recommend as a best solution? My first idea would be to create a (Dependency?) property on the button, to modify the path externally. But how to achieve it as the path property is now part of the control template...