-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathImageButton.xaml
42 lines (38 loc) · 1.92 KB
/
ImageButton.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<Button x:Class="LazyStarter.ImageButton"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:LazyStarter"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"
Background="Transparent"
Name="IMGBTN">
<Button.Template>
<ControlTemplate>
<Grid Name="btnGrid">
<Image Name="contentImage"
Source="{Binding ImageSource, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:ImageButton}}"
Stretch="Fill">
</Image>
</Grid>
<ControlTemplate.Triggers>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsMouseOver, ElementName=contentImage}"
Value="True">
</Condition>
<Condition Binding="{Binding IsImageSourceHoverExist,
RelativeSource={RelativeSource Self}}"
Value="True">
</Condition>
</MultiDataTrigger.Conditions>
<Setter TargetName="contentImage" Property="Source"
Value="{Binding ImageSourceHover,
RelativeSource={RelativeSource Mode=FindAncestor,
AncestorType=local:ImageButton}}"/>
</MultiDataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>