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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
| Namespace ImageButton
Public Class ImageButton
Inherits Button
Shared Sub New()
DefaultStyleKeyProperty.OverrideMetadata(GetType(ImageButton), New FrameworkPropertyMetadata(GetType(ImageButton)))
End Sub
Public Property NormalImage() As ImageSource
Get
Return DirectCast(GetValue(NormalImageProperty), ImageSource)
End Get
Set(value As ImageSource)
SetValue(NormalImageProperty, value)
End Set
End Property
Public Property PressedImage() As ImageSource
Get
Return DirectCast(GetValue(PressedImageProperty), ImageSource)
End Get
Set(value As ImageSource)
SetValue(PressedImageProperty, value)
End Set
End Property
Public Property HoverImage() As ImageSource
Get
Return DirectCast(GetValue(HoverImageProperty), ImageSource)
End Get
Set(value As ImageSource)
SetValue(HoverImageProperty, value)
End Set
End Property
Public Property DisabledImage() As ImageSource
Get
Return DirectCast(GetValue(DisabledImageProperty), ImageSource)
End Get
Set(value As ImageSource)
SetValue(DisabledImageProperty, value)
End Set
End Property
Public Property Stretch() As Stretch
Get
Return DirectCast(GetValue(StretchProperty), Stretch)
End Get
Set(value As Stretch)
SetValue(StretchProperty, value)
End Set
End Property
Public Shared ReadOnly NormalImageProperty As DependencyProperty = DependencyProperty.Register("NormalImage", GetType(ImageSource), GetType(ImageButton), New PropertyMetadata(Nothing))
Public Shared ReadOnly PressedImageProperty As DependencyProperty = DependencyProperty.Register("PressedImage", GetType(ImageSource), GetType(ImageButton), New PropertyMetadata(Nothing))
Public Shared ReadOnly HoverImageProperty As DependencyProperty = DependencyProperty.Register("HoverImage", GetType(ImageSource), GetType(ImageButton), New PropertyMetadata(Nothing))
Public Shared ReadOnly DisabledImageProperty As DependencyProperty = DependencyProperty.Register("DisabledImage", GetType(ImageSource), GetType(ImageButton), New PropertyMetadata(Nothing))
Public Shared ReadOnly StretchProperty As DependencyProperty = DependencyProperty.Register("Stretch", GetType(Stretch), GetType(ImageButton), New PropertyMetadata(Stretch.Uniform))
End Class
End Namespace |
Partager